* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, Helvetica, sans-serif;
}

/* AIBE page */
body.page-aibe {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --text: #1f2937;
    --muted: #4b5563;
    --brand: #0d1b2a;
    --brand-hover: #1b263b;
    --border: #cfd4dc;
    --error: #b42318;
    --success: #166534;
    background-color: var(--bg) !important;
    color: var(--text);
    line-height: 1.6;
}

body.page-aibe header {
    background: #0d1b2a;
    color: #fff;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

body.page-aibe .header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

body.page-aibe .logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
}

body.page-aibe .logo {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff;
}

body.page-aibe nav a {
    color: #fff;
    text-decoration: none;
    margin-left: 20px;
    font-size: 15px;
}

body.page-aibe .dropdown {
    position: relative;
    display: inline-block;
    padding-bottom: 12px;
}

body.page-aibe .dropdown > a {
    display: inline-block;
    padding: 8px 6px;
}

body.page-aibe .dropdown-content {
    display: none;
    position: absolute;
    background-color: #0d1b2a;
    min-width: 180px;
    top: 100%;
    left: 0;
    border-radius: 4px;
    z-index: 1;
    margin-top: 0;
    padding-top: 6px;
}

body.page-aibe .dropdown-content a {
    display: block;
    padding: 10px 15px;
    color: #fff;
    text-decoration: none;
    margin-left: 0;
}

body.page-aibe .dropdown-content a:hover {
    background-color: #1b263b;
}

body.page-aibe .dropdown:hover .dropdown-content {
    display: block;
}

body.page-aibe .page-content {
    max-width: 520px;
    margin: 40px auto 60px;
    padding: 0 20px;
}

body.page-aibe .card {
    background: var(--surface) !important;
    border-radius: 14px;
    padding: 28px 24px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

body.page-aibe h1 {
    margin-bottom: 6px;
    font-size: 30px;
}

body.page-aibe p,
body.page-aibe .field-note {
    color: var(--muted);
}

body.page-aibe .signup-title {
    margin-bottom: 18px;
}

body.page-aibe .google-btn {
    width: 100%;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: 8px;
    padding: 11px 14px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: background 0.2s ease, border-color 0.2s ease;
}

body.page-aibe .google-btn:hover {
    background: #fafafa;
    border-color: #bdbdbd;
}

body.page-aibe .divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 0;
    color: #888;
    font-size: 13px;
}

body.page-aibe .divider::before,
body.page-aibe .divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #ddd;
}

body.page-aibe .signup-form {
    display: grid;
    gap: 14px;
}

body.page-aibe .name-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

body.page-aibe label {
    display: block;
    font-size: 14px;
    margin-bottom: 5px;
    color: var(--text);
    font-weight: 600;
}

body.page-aibe input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 11px;
    font-size: 15px;
    color: var(--text);
    background: #fff;
}

body.page-aibe input::placeholder {
    color: #6b7280;
}

body.page-aibe input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(13, 27, 42, 0.12);
}

body.page-aibe .submit-btn {
    border: none;
    background: var(--brand);
    color: #fff;
    padding: 12px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease;
    margin-top: 4px;
}

body.page-aibe .submit-btn:hover {
    background: var(--brand-hover);
}

body.page-aibe .status {
    min-height: 20px;
    font-size: 14px;
    margin-top: 6px;
}

body.page-aibe .status.error {
    color: var(--error);
}

body.page-aibe .status.success {
    color: var(--success);
}

body.page-aibe .login-link {
    margin-top: 8px;
    font-size: 14px;
    color: var(--muted);
}

body.page-aibe .login-link a {
    color: var(--brand);
    font-weight: 600;
    text-decoration: none;
}

body.page-aibe .login-link a:hover {
    text-decoration: underline;
}

body.page-aibe footer {
    background: #0d1b2a;
    color: #fff;
    text-align: center;
    padding: 20px;
    margin-top: 40px;
}

@media (max-width: 768px) {
    body.page-aibe header {
        flex-direction: column;
        gap: 10px;
    }

    body.page-aibe .name-row {
        grid-template-columns: 1fr;
    }
}

/* Register page */
body.page-register {
    min-height: 100vh;
    background: #e5e7eb !important;
    color: #111827;
    margin: 0;
    overflow-x: hidden;
}

body.page-register .register-shell {
    min-height: calc(100vh - 64px);
    display: grid;
    align-items: start;
    justify-items: center;
    padding: 12px 16px 24px;
    /* Capacitor: reserve bottom safe area */
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}

body.page-register .card {
    width: 100%;
    max-width: 520px;
    background: #ffffff !important;
    border: 1px solid #cbd5e1;
    border-radius: 14px;
    padding: 20px 20px 24px;
    box-shadow: 0 16px 40px rgba(15, 23, 36, 0.15);
    color: #111827;
}

body.page-register h1 {
    font-size: clamp(20px, 5vw, 24px);
    margin-bottom: 4px;
    color: #111827;
    font-weight: 800;
}

body.page-register .subtitle {
    color: #374151;
    margin-bottom: 16px;
    font-size: 14px;
}

body.page-register .status {
    display: none;
    margin-bottom: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    /* 16px so iOS doesn't zoom on focus-triggered scroll */
    font-size: 14px;
    line-height: 1.5;
}

body.page-register .status.success {
    display: block;
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

body.page-register .status.error {
    display: block;
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

body.page-register .status.info {
    display: block;
    background: #eff6ff;
    color: #1e3a8a;
    border: 1px solid #bfdbfe;
}

body.page-register .grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

body.page-register .field-full {
    grid-column: 1 / -1;
}

body.page-register label {
    display: block;
    font-size: 13px;
    margin: 8px 0 4px;
    color: #111827;
    font-weight: 600;
    letter-spacing: .01em;
}

/* ── CRITICAL: 16px prevents iOS auto-zoom on input focus ── */
body.page-register input,
body.page-register select {
    width: 100%;
    min-height: 44px;           /* WCAG touch target */
    padding: 0 12px;
    border: 1.5px solid #94a3b8;
    border-radius: 10px;
    background: #f8fafc;
    color: #111827;
    font-size: 16px;            /* iOS no-zoom threshold */
    line-height: 1.4;
    appearance: none;
    -webkit-appearance: none;
}

body.page-register .mobile-row {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 8px;
}

body.page-register .password-wrap {
    position: relative;
}

body.page-register .password-wrap input {
    padding-right: 48px;
}

body.page-register .toggle-password {
    position: absolute;
    top: 50%;
    right: 4px;
    transform: translateY(-50%);
    /* 44×44 touch target */
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #475569;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body.page-register .toggle-password:hover,
body.page-register .toggle-password:active {
    background: #e2e8f0;
}

body.page-register .password-hints {
    margin-top: 6px;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px 10px;
    font-size: 12px;
    color: #374151;
    line-height: 1.4;
}

body.page-register .password-hints > div,
body.page-register .password-hints > span {
    flex: 0 0 auto;
}

body.page-register .dob-wrap {
    position: relative;
}

body.page-register .dob-wrap input[type="text"] {
    padding-right: 52px;
}

body.page-register .calendar-btn {
    position: absolute;
    top: 50%;
    right: 4px;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #475569;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    z-index: 2;
    -webkit-tap-highlight-color: transparent;
}

body.page-register .calendar-btn:hover,
body.page-register .calendar-btn:active {
    background: #e2e8f0;
}

body.page-register .dob-picker-hidden {
    position: absolute;
    top: 50%;
    right: 4px;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    opacity: 0;
    pointer-events: none;
    border: 0;
    margin: 0;
}

body.page-register .dob-hint {
    margin-top: 4px;
    font-size: 12px;
    color: #374151;
}

body.page-register .strength {
    margin-top: 5px;
    font-size: 12px;
    font-weight: 700;
}

body.page-register .strength.weak   { color: #b91c1c; }
body.page-register .strength.medium { color: #92400e; }
body.page-register .strength.strong { color: #166534; }

body.page-register .match-status {
    margin-top: 5px;
    font-size: 12px;
    font-weight: 700;
}

body.page-register .match-ok { color: #166534; }
body.page-register .match-no { color: #b91c1c; }

body.page-register input:focus,
body.page-register select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

body.page-register .actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 16px;
}

body.page-register button,
body.page-register .back-btn {
    width: 100%;
    min-height: 44px;           /* touch target */
    padding: 0 12px;
    border-radius: 10px;
    border: none;
    font-weight: 700;
    font-size: 15px;            /* readable on mobile */
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    transition: background .18s ease, box-shadow .18s ease;
}

body.page-register button {
    background: #e8ecf3;
    color: #0f1724;
}

body.page-register button:hover,
body.page-register button:active {
    background: #d8dde8;
}

body.page-register .back-btn {
    background: #1e2a40;
    border: 1px solid #3d5175;
    color: #e8ecf3;
    display: inline-flex;
}

body.page-register .back-btn:hover,
body.page-register .back-btn:active {
    background: #263550;
}

/* Mobile: stack name grid on small screens */
@media (max-width: 400px) {
    body.page-register .grid {
        grid-template-columns: 1fr;
    }
    body.page-register .mobile-row {
        grid-template-columns: 100px 1fr;
    }
}
