/* ============================================
   HBOT Refer Now - Skincredible
   Mobile-first PWA Stylesheet
   ============================================ */

:root {
    --blue-50: #eff6ff;
    --blue-100: #dbeafe;
    --blue-400: #60a5fa;
    --blue-500: #3b82f6;
    --blue-600: #2563eb;
    --blue-700: #1d4ed8;
    --teal-400: #2dd4bf;
    --teal-500: #14b8a6;
    --teal-600: #0d9488;
    --slate-50: #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-800: #1e293b;
    --slate-900: #0f172a;
    --white: #ffffff;
    --green-500: #22c55e;
    --green-dark: #2c5f3f;
    --green-mid: #3a7d53;
    --green-light: #e8f3ec;
    --green-accent: #4a9e6a;
    --cream: #faf9f6;
    --red-500: #ef4444;
    --radius: 12px;
    --radius-xl: 16px;
    --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
    --shadow: 0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font);
    color: var(--slate-800);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overscroll-behavior: none;
}

a { color: var(--blue-600); text-decoration: none; }
img { max-width: 100%; display: block; }
input, select, textarea, button { font-family: var(--font); }

/* ============ LOGIN PAGE ============ */
.login-body {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--slate-50) 0%, #eff6ff40 50%, #f0fdfa30 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: var(--white);
    border-radius: 20px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08), 0 0 0 1px rgba(0,0,0,0.04);
    padding: 40px 36px;
    text-align: center;
}

.login-logo {
    margin-bottom: 24px;
}

.login-logo-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--white);
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    overflow: hidden;
}

.login-logo-img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    border-radius: 50%;
}

.login-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--slate-800);
    margin-bottom: 6px;
    line-height: 1.3;
}

.login-subtitle {
    font-size: 0.9rem;
    color: var(--slate-500);
    margin-bottom: 28px;
}

/* Social Buttons */
.social-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}

.social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    background: var(--white);
    border: 1.5px solid var(--slate-200);
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--slate-700);
    cursor: pointer;
    transition: all 0.15s ease;
}

.social-btn:hover:not(:disabled) {
    background: var(--slate-50);
    border-color: var(--slate-300);
}

.social-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Login Divider */
.login-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    color: var(--slate-400);
    font-size: 0.8rem;
    font-weight: 500;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--slate-200);
}

/* Login Form */
.login-form {
    text-align: left;
}

.login-form .form-group {
    margin-bottom: 16px;
}

.login-form label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--slate-700);
    margin-bottom: 6px;
    text-align: center;
}

.input-with-icon {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--slate-400);
    pointer-events: none;
}

.input-with-icon input {
    width: 100%;
    padding: 12px 14px 12px 40px;
    border: 1.5px solid var(--slate-200);
    border-radius: 10px;
    font-size: 0.9rem;
    color: var(--slate-800);
    transition: all 0.15s ease;
    background: var(--white);
}

.input-with-icon input:focus {
    outline: none;
    border-color: var(--blue-400);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.btn-signin {
    width: 100%;
    padding: 12px;
    background: var(--slate-900);
    color: var(--white);
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-top: 4px;
}

.btn-signin:hover {
    background: var(--slate-800);
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 16px;
}

.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

/* ============ APP PAGE (REFERRAL FORM) ============ */
.app-body {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--slate-50) 0%, rgba(239,246,255,0.3) 50%, rgba(240,253,250,0.2) 100%);
    overscroll-behavior: none;
}

/* Header */
.app-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255,255,255,0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(226,232,240,0.6);
    box-shadow: var(--shadow-sm);
    padding-top: env(safe-area-inset-top);
}

.header-inner {
    max-width: 672px;
    margin: 0 auto;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-logo {
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--blue-600), var(--teal-500));
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(59,130,246,0.2);
}

.icon-white { color: var(--white); }

.header-brand-sub {
    font-size: 0.7rem;
    color: var(--slate-500);
    font-weight: 500;
    line-height: 1;
}

.header-brand {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--slate-800);
    letter-spacing: -0.3px;
    line-height: 1.2;
}

.header-right { text-align: right; }

.header-facility {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--slate-800);
}

/* Settings Button */
.settings-btn-wrap {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 51;
}

.settings-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255,255,255,0.8);
    backdrop-filter: blur(8px);
    border: 1px solid var(--slate-200);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--slate-600);
    transition: all 0.15s ease;
    box-shadow: var(--shadow-sm);
    padding-top: env(safe-area-inset-top, 0);
}

.settings-btn:hover { background: var(--white); border-color: var(--slate-300); }

.settings-dropdown {
    display: none;
    position: absolute;
    top: 40px;
    right: 0;
    width: 220px;
    background: var(--white);
    border: 1px solid var(--slate-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    z-index: 100;
}

.settings-dropdown.open { display: block; }

.settings-user {
    padding: 12px 16px;
    border-bottom: 1px solid var(--slate-100);
}

.settings-user-name { font-size: 0.85rem; font-weight: 600; color: var(--slate-800); }
.settings-user-email { font-size: 0.75rem; color: var(--slate-500); }

.settings-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 0.85rem;
    color: var(--slate-600);
    transition: background 0.1s;
}

.settings-link:hover { background: var(--slate-50); }
.settings-link-danger { color: var(--red-500); }

/* Main */
.app-main {
    max-width: 672px;
    margin: 0 auto;
    padding: 24px 16px 96px;
}

/* Info Banner */
.info-banner {
    margin-bottom: 24px;
}

.info-banner-btn {
    width: 100%;
    padding: 16px;
    border-radius: var(--radius-xl);
    border: 1px solid rgba(191,219,254,0.6);
    background: linear-gradient(135deg, var(--blue-50), rgba(240,253,250,0.6));
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.info-banner-btn:hover {
    box-shadow: var(--shadow);
    border-color: rgba(147,197,253,0.6);
}

.info-banner-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.info-banner-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--blue-500), var(--teal-500));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.info-banner-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--slate-800);
    text-align: left;
}

.info-banner-sub {
    font-size: 0.75rem;
    color: var(--slate-500);
    text-align: left;
}

.info-banner-chevron {
    color: var(--slate-400);
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.info-banner-chevron.open {
    transform: rotate(180deg);
}

.info-banner-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.info-banner-content.open {
    max-height: 1200px;
}

.info-banner-body {
    padding: 16px;
    font-size: 0.85rem;
    color: var(--slate-600);
    line-height: 1.7;
}

.info-banner-body p { margin-bottom: 8px; }
.info-banner-body p:last-child { margin-bottom: 0; }

/* Guide Accordion (inside info-banner) */
.guide-accordion {
    padding: 12px 0 4px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.guide-item {
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid rgba(226,232,240,0.8);
    overflow: hidden;
}

.guide-item-btn {
    width: 100%;
    padding: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: none;
    border: none;
    cursor: pointer;
    transition: background 0.15s ease;
    user-select: none;
}

.guide-item-btn:hover {
    background: rgba(248,250,252,0.5);
}

.guide-item-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.guide-item-left span {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--slate-700);
}

.guide-item-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--slate-100);
    color: var(--slate-500);
    flex-shrink: 0;
}

.guide-item-icon svg {
    color: inherit;
}

.guide-item-icon-gradient {
    background: linear-gradient(135deg, var(--blue-500), var(--teal-500));
    color: var(--white);
}

.guide-chevron {
    color: var(--slate-400);
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.guide-item.open .guide-chevron {
    transform: rotate(180deg);
}

.guide-item-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.guide-item.open .guide-item-body {
    max-height: 200px;
}

.guide-item.open .guide-item-body-lg {
    max-height: 2000px;
    transition: max-height 0.5s ease;
}

.guide-body-content {
    padding: 0 16px 16px;
}

.guide-body-content > p {
    font-size: 0.85rem;
    color: var(--slate-600);
    line-height: 1.65;
    margin: 0 0 12px;
}

.guide-item-body p {
    padding: 0 16px 16px;
    font-size: 0.85rem;
    color: var(--slate-600);
    line-height: 1.65;
    margin: 0;
}

/* --- ICD Code Sub-Accordion --- */
.icd-accordion {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.icd-item-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    font-family: var(--font);
    text-align: left;
    transition: background 0.15s ease;
}

.icd-item-btn:hover {
    background: var(--slate-50);
}

.icd-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--blue-500), var(--teal-500));
    flex-shrink: 0;
}

.icd-label {
    flex: 1;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--slate-700);
    line-height: 1.3;
}

.icd-chevron {
    color: var(--slate-300);
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.icd-item.open .icd-chevron {
    transform: rotate(180deg);
}

.icd-item.open .icd-item-btn {
    background: var(--slate-50);
}

.icd-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
}

.icd-item.open .icd-body {
    max-height: 200px;
}

.icd-codes {
    padding: 6px 10px 10px 24px;
    font-size: 0.73rem;
    color: var(--slate-500);
    line-height: 1.8;
}

.icd-code {
    display: inline-block;
    padding: 1px 6px;
    background: rgba(59, 130, 246, 0.07);
    border: 1px solid rgba(59, 130, 246, 0.12);
    border-radius: 4px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--blue-600);
    margin-right: 4px;
    letter-spacing: 0.02em;
}

/* Dark mode ICD */
[data-theme="dark"] .icd-item-btn:hover,
[data-theme="dark"] .icd-item.open .icd-item-btn {
    background: rgba(51, 65, 85, 0.4);
}

[data-theme="dark"] .icd-code {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.18);
}

/* Guide CTA */
.guide-cta {
    padding-top: 4px;
}

.guide-cta-btn {
    width: 100%;
    padding: 12px 16px;
    background: linear-gradient(135deg, var(--blue-600), var(--teal-600));
    color: var(--white);
    border: none;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.guide-cta-btn:hover {
    box-shadow: 0 4px 14px rgba(59,130,246,0.25);
}

.guide-cta-btn svg {
    color: var(--white);
}

/* Guide Feedback */
.guide-feedback {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 10px 0 4px;
    user-select: none;
}

.guide-feedback span {
    font-size: 0.7rem;
    color: var(--slate-400);
}

.guide-feedback-btns {
    display: flex;
    gap: 8px;
}

.guide-feedback-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--slate-100);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--slate-400);
    transition: all 0.15s ease;
}

.guide-feedback-btn:hover {
    background: var(--slate-200);
    color: var(--slate-600);
}

.guide-feedback-btn.active {
    background: var(--blue-100);
    color: var(--blue-600);
}

/* Form Title */
.form-title-section {
    text-align: center;
    margin-bottom: 24px;
    user-select: none;
}

.form-title {
    font-family: 'Merriweather', serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--green-dark);
    margin-bottom: 4px;
}

.form-subtitle {
    font-size: 0.85rem;
    color: var(--slate-500);
}

/* Form Cards */
.form-card {
    background: var(--white);
    border-radius: var(--radius-xl);
    border: 1px solid rgba(226,232,240,0.8);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}

.form-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--green-light);
    margin-bottom: 16px;
    user-select: none;
}

.form-card-header h3 {
    font-family: 'Merriweather', serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--green-dark);
}

.form-card-hint {
    font-size: 0.7rem;
    color: var(--slate-400);
    margin-left: auto;
}

.icon-blue { color: var(--blue-600); }
.icon-teal { color: var(--teal-600); }

/* Form Fields */
.form-field {
    margin-bottom: 16px;
}

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

.form-field label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--slate-500);
    margin-bottom: 6px;
    user-select: none;
}

.form-field label svg { color: var(--slate-400); }

.req { color: var(--red-500); }

.form-field input,
.form-field select,
.form-field textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--slate-200);
    border-radius: var(--radius);
    font-size: 0.9rem;
    color: var(--slate-800);
    background: var(--cream);
    transition: all 0.15s ease;
    height: 44px;
}

.form-field textarea {
    height: auto;
    min-height: 96px;
    resize: none;
    line-height: 1.5;
}

.form-field select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-field input::placeholder,
.form-field textarea::placeholder {
    color: var(--slate-400);
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    outline: none;
    border-color: var(--green-mid);
    box-shadow: 0 0 0 3px rgba(58, 125, 83, 0.12);
    background: var(--white);
}

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.full-width { grid-column: 1 / -1; }

/* Upload Buttons */
.upload-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.file-hidden { display: none; }

.upload-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 48px;
    border-radius: var(--radius);
    border: 2px dashed var(--slate-200);
    background: var(--white);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--slate-600);
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.upload-btn:hover {
    border-color: var(--blue-400);
    background: rgba(239,246,255,0.5);
    color: var(--blue-600);
}

.file-preview {
    margin-top: 8px;
    font-size: 0.8rem;
    color: var(--slate-500);
}

.file-preview .file-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: var(--blue-50);
    border-radius: 6px;
    margin: 4px 4px 0 0;
    color: var(--blue-700);
    font-weight: 500;
}

.file-preview .file-item .file-remove {
    background: none;
    border: none;
    color: var(--slate-400);
    cursor: pointer;
    padding: 0 0 0 4px;
    font-size: 1rem;
    line-height: 1;
    display: flex;
}

.file-preview .file-item .file-remove:hover {
    color: var(--red-500, #ef4444);
}

/* Attestation */
.attestation-box {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: rgba(239,246,255,0.5);
    border-radius: var(--radius);
    margin-bottom: 16px;
}

.attestation-box input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin-top: 3px;
    flex-shrink: 0;
    accent-color: var(--blue-600);
    cursor: pointer;
}

.attestation-box label {
    font-size: 0.85rem;
    color: var(--slate-600);
    line-height: 1.5;
    cursor: pointer;
}

/* Signature */
.signature-container {
    position: relative;
    margin-bottom: 8px;
}

#signatureCanvas {
    width: 100%;
    height: 128px;
    border: 2px dashed var(--slate-200);
    border-radius: var(--radius);
    cursor: crosshair;
    touch-action: none;
    background: rgba(248,250,252,0.5);
}

.signature-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    font-size: 0.85rem;
    color: var(--slate-400);
    user-select: none;
}

.signature-clear {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--slate-400);
    background: var(--white);
    border: 1px solid var(--slate-200);
    border-radius: 6px;
    padding: 4px 10px;
    cursor: pointer;
    display: none;
}

.signature-clear.visible { display: block; }

.signature-disclaimer {
    font-size: 0.7rem;
    color: var(--slate-400);
    text-align: center;
    user-select: none;
}

/* Submit */
.btn-submit {
    width: 100%;
    height: 56px;
    border-radius: var(--radius);
    border: none;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    margin-bottom: 12px;
}

.btn-submit:disabled {
    background: var(--slate-200);
    color: var(--slate-500);
    cursor: not-allowed;
}

.btn-submit:not(:disabled) {
    background: linear-gradient(135deg, var(--blue-600), var(--teal-500));
    color: var(--white);
    box-shadow: 0 4px 14px rgba(59,130,246,0.3);
}

.btn-submit:not(:disabled):hover {
    box-shadow: 0 6px 20px rgba(59,130,246,0.4);
    transform: translateY(-1px);
}

.action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.btn-action {
    height: 48px;
    border-radius: var(--radius);
    border: 1px solid var(--slate-200);
    background: var(--white);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--slate-600);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.btn-action:hover {
    background: var(--slate-50);
}

/* Checklist */
.checklist {
    padding: 0 8px;
    margin-top: 8px;
    user-select: none;
}

.checklist-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--slate-600);
    margin-bottom: 10px;
}

.checklist-items {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
}

.checklist-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--slate-400);
}

.checklist-item.complete { color: var(--green-500); }

.checklist-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--slate-200);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.checklist-item.complete .checklist-dot {
    background: var(--green-500);
}

.checklist-item.complete .checklist-dot::after {
    content: '';
    width: 5px;
    height: 5px;
    background: #fff;
    border-radius: 50%;
}

/* Footer */
.app-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-top: 1px solid rgba(226,232,240,0.6);
    padding: 12px 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    user-select: none;
    z-index: 40;
}

.footer-inner {
    max-width: 672px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--slate-500);
}

.footer-inner a {
    color: var(--blue-600);
    font-weight: 500;
}

/* Footer AI Link */
.footer-ai-link {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0;
    border: none;
    background: none;
    font-family: var(--font);
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--blue-600);
    cursor: pointer;
    transition: all 0.15s ease;
}

.footer-ai-link:hover {
    color: var(--blue-700);
}

.footer-ai-link svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.footer-ai-link:hover svg {
    opacity: 1;
}

/* ============ AI EXPLAINER MODAL ============ */
.ai-explainer-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.ai-explainer-overlay.open {
    opacity: 1;
    visibility: visible;
}

.ai-explainer-modal {
    width: 100%;
    max-width: 480px;
    max-height: calc(100vh - 40px);
    background: var(--white);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2), 0 0 0 1px rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(16px) scale(0.96);
    transition: transform 0.25s ease;
}

.ai-explainer-overlay.open .ai-explainer-modal {
    transform: translateY(0) scale(1);
}

/* Header */
.ai-explainer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 0;
    flex-shrink: 0;
}

.ai-explainer-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-explainer-robot {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(37,99,235,0.08), rgba(20,184,166,0.06));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ai-explainer-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--slate-800);
    margin: 0;
    line-height: 1.3;
}

.ai-explainer-badge {
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--teal-600);
    margin: 0;
}

.ai-explainer-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--slate-400);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.ai-explainer-close:hover {
    background: var(--slate-100);
    color: var(--slate-600);
}

/* Body */
.ai-explainer-body {
    padding: 20px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.ai-explainer-intro {
    font-size: 0.85rem;
    color: var(--slate-500);
    line-height: 1.6;
    margin: 0 0 20px;
}

/* Feature list */
.ai-explainer-features {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ai-explainer-feature {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.ai-explainer-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ai-explainer-icon.blue { background: rgba(59,130,246,0.1); color: var(--blue-600); }
.ai-explainer-icon.teal { background: rgba(20,184,166,0.1); color: var(--teal-600); }
.ai-explainer-icon.violet { background: rgba(124,58,237,0.1); color: #7c3aed; }
.ai-explainer-icon.rose { background: rgba(244,63,94,0.1); color: #e11d48; }
.ai-explainer-icon.amber { background: rgba(245,158,11,0.1); color: #d97706; }

.ai-explainer-feature h4 {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--slate-800);
    margin: 0 0 2px;
    line-height: 1.3;
}

.ai-explainer-feature p {
    font-size: 0.75rem;
    color: var(--slate-500);
    margin: 0;
    line-height: 1.55;
}

/* Privacy note */
.ai-explainer-footer-note {
    margin-top: 20px;
    padding: 12px;
    background: var(--slate-50);
    border-radius: var(--radius);
    border: 1px solid var(--slate-100);
}

.ai-explainer-footer-note p {
    font-size: 0.72rem;
    color: var(--slate-400);
    margin: 0;
    line-height: 1.5;
}

/* Action */
.ai-explainer-action {
    padding: 16px 20px;
    border-top: 1px solid var(--slate-100);
    flex-shrink: 0;
}

.ai-explainer-got-it {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--blue-600), var(--teal-500));
    color: #ffffff;
    font-size: 0.88rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.15s ease;
}

.ai-explainer-got-it:hover {
    box-shadow: 0 4px 14px rgba(59,130,246,0.3);
    transform: translateY(-1px);
}

/* Dark mode */
[data-theme="dark"] .ai-explainer-overlay {
    background: rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .ai-explainer-modal {
    box-shadow: 0 20px 60px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.03);
}

[data-theme="dark"] .ai-explainer-footer-note {
    background: #293548;
    border-color: rgba(51,65,85,0.6);
}

/* Responsive */
@media (max-width: 640px) {
    .ai-explainer-modal {
        max-width: 100%;
        border-radius: 16px;
    }

    .footer-ai-link span {
        display: none;
    }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 640px) {
    .form-grid-2 {
        grid-template-columns: 1fr;
    }

    .login-card {
        padding: 32px 24px;
    }

    .login-title {
        font-size: 1.2rem;
    }

    .header-brand {
        font-size: 0.8rem;
    }

    .header-facility {
        font-size: 0.75rem;
    }
}

/* AI Auto-fill highlight */
.ai-autofilled {
    background: rgba(59, 130, 246, 0.06) !important;
    border-color: var(--blue-400) !important;
    animation: ai-filled-pulse 0.6s ease;
}

@keyframes ai-filled-pulse {
    0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.3); }
    70% { box-shadow: 0 0 0 6px rgba(59, 130, 246, 0); }
    100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

/* ============ DRAFT BANNER ============ */
.draft-banner {
    margin-bottom: 16px;
}

.draft-banner-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(59,130,246,0.08), rgba(20,184,166,0.06));
    border: 1px solid rgba(59,130,246,0.2);
    border-radius: var(--radius);
    animation: draft-slide-in 0.3s ease;
}

@keyframes draft-slide-in {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.draft-banner-text {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--blue-600);
}

.draft-banner-text svg {
    flex-shrink: 0;
    color: var(--blue-500);
}

.draft-banner-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.draft-restore-btn {
    padding: 6px 14px;
    background: var(--blue-600);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.15s ease;
}

.draft-restore-btn:hover {
    background: var(--blue-700);
}

.draft-dismiss-btn {
    padding: 6px 12px;
    background: transparent;
    color: var(--slate-400);
    border: 1px solid var(--slate-200);
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.15s ease;
}

.draft-dismiss-btn:hover {
    background: var(--slate-50);
    color: var(--slate-600);
}

/* ============ TOGGLE SWITCH ============ */
.settings-link-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: default;
}

.toggle-switch {
    position: relative;
    width: 36px;
    height: 20px;
    margin-left: auto;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--slate-200);
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    left: 2px;
    top: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
    transition: transform 0.2s ease;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--blue-500);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(16px);
}

/* ============ DARK MODE ============ */
[data-theme="dark"] {
    --white: #0f172a;
    --slate-50: #1e293b;
    --slate-100: #293548;
    --slate-200: #334155;
    --slate-300: #475569;
    --slate-400: #94a3b8;
    --slate-500: #94a3b8;
    --slate-600: #cbd5e1;
    --slate-700: #e2e8f0;
    --slate-800: #f1f5f9;
    --slate-900: #f8fafc;
    --blue-50: #172554;
    --blue-100: #1e3a5f;
    --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.3);
    --shadow: 0 1px 3px 0 rgba(0,0,0,0.4), 0 1px 2px -1px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.4), 0 4px 6px -4px rgba(0,0,0,0.3);
    --green-dark: #6acea8;
    --green-mid: #5cb88a;
    --green-light: rgba(58, 125, 83, 0.2);
    --green-accent: #4a9e6a;
    --cream: #1e293b;
}

[data-theme="dark"] .app-body {
    background: linear-gradient(135deg, #0f172a 0%, #0f1629 50%, #0e1524 100%);
}

[data-theme="dark"] .app-header {
    background: rgba(15,23,42,0.85);
    border-bottom-color: rgba(51,65,85,0.6);
}

[data-theme="dark"] .app-footer {
    background: rgba(15,23,42,0.9);
    border-top-color: rgba(51,65,85,0.6);
}

[data-theme="dark"] .settings-btn {
    background: rgba(30,41,59,0.8);
    border-color: var(--slate-200);
}

[data-theme="dark"] .info-banner-btn {
    background: linear-gradient(135deg, rgba(23,37,84,0.5), rgba(13,60,56,0.3));
    border-color: rgba(51,65,85,0.6);
}

[data-theme="dark"] .login-body {
    background: linear-gradient(135deg, #0f172a 0%, rgba(23,37,84,0.3) 50%, rgba(13,60,56,0.15) 100%);
}

[data-theme="dark"] .login-card {
    box-shadow: 0 4px 24px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.03);
}

[data-theme="dark"] .form-card {
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    border-color: rgba(51,65,85,0.6);
}

[data-theme="dark"] .form-field input,
[data-theme="dark"] .form-field select,
[data-theme="dark"] .form-field textarea {
    background: var(--slate-50);
    color: var(--slate-800);
}

[data-theme="dark"] .form-field input::placeholder,
[data-theme="dark"] .form-field textarea::placeholder {
    color: var(--slate-300);
}

[data-theme="dark"] #signatureCanvas {
    background: rgba(30,41,59,0.5);
    border-color: var(--slate-200);
}

[data-theme="dark"] .guide-item {
    background: var(--slate-50);
    border-color: rgba(51,65,85,0.6);
}

[data-theme="dark"] .alert-error { background: rgba(127,29,29,0.15); color: #fca5a5; border-color: rgba(239,68,68,0.2); }
[data-theme="dark"] .alert-success { background: rgba(22,101,52,0.15); color: #86efac; border-color: rgba(34,197,94,0.2); }

[data-theme="dark"] .attestation-box {
    background: rgba(23,37,84,0.3);
}

[data-theme="dark"] .social-btn {
    background: var(--slate-50);
    border-color: var(--slate-200);
    color: var(--slate-700);
}

[data-theme="dark"] .input-with-icon input {
    background: var(--slate-50);
    color: var(--slate-800);
    border-color: var(--slate-200);
}

/* Elements using var(--white) for text on colored backgrounds need explicit white */
[data-theme="dark"] .icon-white,
[data-theme="dark"] .btn-submit:not(:disabled),
[data-theme="dark"] .guide-cta-btn,
[data-theme="dark"] .guide-cta-btn svg,
[data-theme="dark"] .guide-item-icon-gradient,
[data-theme="dark"] .btn-signin {
    color: #ffffff;
}

[data-theme="dark"] .settings-dropdown {
    background: #1e293b;
    border-color: rgba(51,65,85,0.6);
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}

[data-theme="dark"] .checklist-title {
    color: #94a3b8;
}

[data-theme="dark"] .checklist-item {
    color: #64748b;
}

[data-theme="dark"] .checklist-item.complete {
    color: var(--green-500);
}

[data-theme="dark"] .checklist-dot {
    background: #475569;
}

/* Print */
@media print {
    .app-header, .app-footer, .settings-btn-wrap,
    .info-banner, .btn-submit, .action-grid,
    .upload-grid, .signature-container, .signature-clear,
    .signature-disclaimer, .checklist, .attestation-box,
    .ai-assistant { display: none !important; }

    .app-body { background: white; }
    .app-main { padding: 0; max-width: 100%; }
    .form-card { box-shadow: none; border: 1px solid #ddd; page-break-inside: avoid; }
}
