:root {
    --blue: #1a56db;
    --blue-light: #e8f0fe;
    --blue-dark: #1240a8;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-400: #9ca3af;
    --gray-600: #4b5563;
    --gray-800: #1f2937;
    --green: #057a55;
    --green-light: #e3fcef;
    --red: #c81e1e;
    --red-light: #fde8e8;
    --amber: #92400e;
    --amber-light: #fef3c7;
    --white: #ffffff;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    font-size: 15px;
    line-height: 1.6;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ── */
.container { max-width: 720px; margin: 0 auto; padding: 0 1.5rem; }
.container-wide { max-width: 1100px; margin: 0 auto; padding: 0 1.5rem; }

/* ── Top bar ── */
.topbar {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: 1rem 0;
}
.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.topbar .logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-800);
}
.topbar .logo img { height: 36px; }
.topbar-right { font-size: 13px; color: var(--gray-600); }

/* ── Progress bar ── */
.progress-wrap {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: 1.25rem 0;
}
.progress-steps {
    display: flex;
    align-items: center;
    gap: 0;
    overflow-x: auto;
}
.step-item {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}
.step-bubble {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--gray-200);
    color: var(--gray-600);
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
}
.step-bubble.done { background: var(--green); color: #fff; }
.step-bubble.active { background: var(--blue); color: #fff; }
.step-label {
    font-size: 12px;
    color: var(--gray-600);
    margin-left: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.step-label.active { color: var(--blue); font-weight: 500; }
.step-label.done { color: var(--green); }
.step-connector {
    flex: 1;
    height: 1px;
    background: var(--gray-200);
    margin: 0 8px;
    min-width: 12px;
}
.step-connector.done { background: var(--green); }

/* ── Cards ── */
.card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow);
    margin: 2rem 0;
}
.card-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.5rem;
}
.card-subtitle {
    color: var(--gray-600);
    font-size: 14px;
    margin-bottom: 1.5rem;
}
.card-section {
    border-top: 1px solid var(--gray-200);
    margin-top: 1.5rem;
    padding-top: 1.5rem;
}

/* ── Forms ── */
.form-group { margin-bottom: 1.25rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-600);
    margin-bottom: 4px;
}
input[type=text], input[type=email], input[type=tel], input[type=password],
select, textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--gray-800);
    background: var(--white);
    transition: border 0.15s;
    outline: none;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(26,86,219,0.1);
}
textarea { resize: vertical; min-height: 80px; }
.form-hint { font-size: 12px; color: var(--gray-400); margin-top: 3px; }
.required { color: var(--red); }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s;
    text-decoration: none;
}
.btn-primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn-primary:hover { background: var(--blue-dark); text-decoration: none; color: #fff; }
.btn-secondary { background: var(--white); color: var(--gray-800); border-color: var(--gray-200); }
.btn-secondary:hover { background: var(--gray-100); text-decoration: none; }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #046344; text-decoration: none; color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #a01717; text-decoration: none; color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 12px 28px; font-size: 15px; }
.btn-full { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-group { display: flex; gap: 10px; margin-top: 1.5rem; flex-wrap: wrap; }

/* ── Alerts ── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.alert-info { background: var(--blue-light); color: #1240a8; border: 1px solid #c3d6fb; }
.alert-success { background: var(--green-light); color: #046344; border: 1px solid #a3f0c7; }
.alert-warning { background: var(--amber-light); color: var(--amber); border: 1px solid #fcd34d; }
.alert-danger { background: var(--red-light); color: var(--red); border: 1px solid #fca5a5; }

/* ── Badges ── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    gap: 4px;
}
.badge-success { background: var(--green-light); color: var(--green); }
.badge-warning { background: var(--amber-light); color: var(--amber); }
.badge-info { background: var(--blue-light); color: var(--blue-dark); }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }

/* ── Tables (admin) ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; font-weight: 500; color: var(--gray-600); padding: 10px 12px; border-bottom: 1px solid var(--gray-200); background: var(--gray-50); }
td { padding: 12px 12px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--gray-50); }

/* ── Signature pad ── */
.sig-pad-wrap {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    background: #fafafa;
    position: relative;
    overflow: hidden;
}
.sig-pad-wrap canvas { display: block; touch-action: none; }
.sig-controls { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; border-top: 1px solid var(--gray-200); background: var(--gray-50); }
.sig-hint { font-size: 12px; color: var(--gray-400); }

/* ── Document preview ── */
.doc-section {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 1.5rem;
}
.doc-header {
    background: var(--gray-50);
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.doc-header h3 { font-size: 14px; font-weight: 600; color: var(--gray-800); }
.doc-body { padding: 1.5rem; font-size: 14px; line-height: 1.7; }
.doc-body h4 { font-size: 13px; font-weight: 600; margin: 1rem 0 0.25rem; color: var(--gray-800); }
.doc-body p { margin-bottom: 0.75rem; color: var(--gray-600); }
.doc-body ul { margin: 0.5rem 0 0.75rem 1.25rem; color: var(--gray-600); }
.doc-body table { font-size: 13px; margin-bottom: 1rem; }
.doc-body table th, .doc-body table td { padding: 6px 10px; }

/* ── Step content ── */
.step-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--blue-light);
    color: var(--blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    margin-bottom: 1rem;
}
.step-icon.green { background: var(--green-light); color: var(--green); }
.step-icon.amber { background: var(--amber-light); color: var(--amber); }

/* ── Install steps ── */
.install-step {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.25rem;
    align-items: flex-start;
}
.install-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--blue);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}
.install-text h4 { font-size: 14px; font-weight: 600; margin-bottom: 3px; }
.install-text p { font-size: 13px; color: var(--gray-600); }

/* ── OS tabs ── */
.os-tabs { display: flex; gap: 8px; margin-bottom: 1.5rem; }
.os-tab {
    padding: 7px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    background: var(--white);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-600);
}
.os-tab.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.os-content { display: none; }
.os-content.active { display: block; }

/* ── Password reveal ── */
.pw-tip {
    background: var(--amber-light);
    border: 1px solid #fcd34d;
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}
.pw-tip h4 { font-size: 14px; font-weight: 600; color: var(--amber); margin-bottom: 6px; }
.pw-tip ul { margin-left: 1.2rem; font-size: 13px; color: #78350f; }

/* ── Done page ── */
.done-hero {
    text-align: center;
    padding: 2rem 0 1rem;
}
.done-check {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--green-light);
    color: var(--green);
    font-size: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}
.done-hero h2 { font-size: 24px; font-weight: 600; margin-bottom: 0.5rem; }
.done-hero p { color: var(--gray-600); max-width: 420px; margin: 0 auto; }

/* ── Admin ── */
.admin-nav {
    background: var(--gray-800);
    padding: 0;
}
.admin-nav-inner {
    display: flex;
    align-items: center;
    gap: 0;
}
.admin-nav a {
    color: rgba(255,255,255,0.7);
    padding: 14px 18px;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.15s, background 0.15s;
    text-decoration: none;
}
.admin-nav a:hover, .admin-nav a.active {
    color: #fff;
    background: rgba(255,255,255,0.08);
}
.admin-header {
    padding: 1.5rem 0 1rem;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}
.admin-header h1 { font-size: 20px; font-weight: 600; }
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 1.5rem;
}
.stat-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow);
}
.stat-label { font-size: 12px; color: var(--gray-600); margin-bottom: 4px; }
.stat-value { font-size: 26px; font-weight: 600; color: var(--gray-800); }

/* ── Progress circle ── */
.progress-ring { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--gray-600); }

/* ── Copy link ── */
.link-box {
    display: flex;
    gap: 8px;
    align-items: center;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 8px 12px;
    font-size: 12px;
    font-family: monospace;
    color: var(--gray-600);
    word-break: break-all;
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .form-row { grid-template-columns: 1fr; }
    .card { padding: 1.25rem; }
    .step-label { display: none; }
    .btn-group { flex-direction: column; }
    .btn-group .btn { width: 100%; justify-content: center; }
}
