/* ==========================================================================
   PROFILE_MOBILE_FORCE_MIGRATION_V1
   Migrated from shared mobile-force.css.
   ========================================================================== */

@media (max-width: 900px) {
    .profile-page {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        overflow-x: hidden !important;
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

    .profile-card {
        max-width: 100% !important;
        min-width: 0 !important;
        overflow-wrap: anywhere !important;
        word-break: normal !important;
    }

    .profile-grid {
        grid-template-columns: 1fr !important;
    }

    .profile-crop-modal {
        padding: 10px !important;
        align-items: flex-start !important;
        overflow-y: auto !important;
    }

    .profile-crop-modal > * {
        width: min(100%, 560px) !important;
        max-width: 100% !important;
        max-height: calc(100vh - 24px) !important;
        overflow-y: auto !important;
        border-radius: 18px !important;
    }
}

@media (max-width: 480px) {
    .profile-page {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }

    .profile-crop-modal {
        padding: 8px !important;
    }
}


/* ==========================================================================
   PROFILE_RUNTIME_CSS_MIGRATION_V1
   Exact CSS previously injected by ensureProfileStyles().
   ========================================================================== */

/* PROFILE_TOP_LAYOUT_POLISH_V1 */
.profile-grid {
    display: grid !important;
    grid-template-columns: minmax(0, 1.2fr) minmax(360px, .8fr) !important;
    grid-template-areas:
        "basic account"
        "basic security"
        "student student" !important;
    gap: 16px !important;
    align-items: start !important;
}

.profile-edit-card {
    grid-area: basic !important;
}

.profile-account-card {
    grid-area: account !important;
}

.profile-security-card {
    grid-area: security !important;
}

.profile-student-hub {
    grid-area: student !important;
}

/* كارت معلومات الحساب: الدور والحالة واللغة في صف واضح */
.profile-account-card .profile-facts {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 10px !important;
}

.profile-account-card .profile-fact,
.profile-account-card .profile-facts > div {
    min-height: 74px !important;
}

/* كارت الأمان يكون مضغوط وعلى قد المحتوى */
.profile-security-card {
    min-height: 0 !important;
}

.profile-security-card .profile-security-box {
    min-height: 142px !important;
    display: grid !important;
    align-content: center !important;
    gap: 10px !important;
}

.profile-security-card .profile-security-box p {
    margin: 0 !important;
    line-height: 1.8 !important;
}

.profile-security-card .profile-password-toggle {
    width: fit-content !important;
    justify-self: start !important;
}

/* المعلومات الأساسية تأخذ مساحة منظمة */
.profile-edit-card {
    min-height: 100% !important;
}

.profile-edit-card .profile-name-editor {
    margin-bottom: 14px !important;
}

/* بيانات الطالب والتواصل تحت بعرض الصفحة */
.profile-student-hub {
    margin-top: 0 !important;
}

/* تحسين عام للكروت */
.profile-card {
    border-radius: 22px !important;
    box-shadow: 0 12px 34px rgba(24, 61, 47, .045) !important;
}

/* إخفاء أي بقايا قديمة للتفضيلات لو ظلت من CSS/DOM */
.profile-preferences {
    display: none !important;
}

@media (max-width: 1100px) {
    .profile-grid {
        grid-template-columns: 1fr !important;
        grid-template-areas:
            "basic"
            "account"
            "security"
            "student" !important;
    }

    .profile-account-card .profile-facts {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 680px) {
    .profile-account-card .profile-facts {
        grid-template-columns: 1fr !important;
    }

    .profile-security-card .profile-password-toggle {
        width: 100% !important;
    }
}

/* PROFILE_EDIT_BUTTONS_VISUAL_FIX_V1 */
.profile-editable-fact {
    position: relative !important;
    display: block !important;
    min-height: 72px !important;
    padding: 14px 46px 14px 14px !important;
    border: 1px solid #eee7dc !important;
    background: #fffdf8 !important;
    border-radius: 14px !important;
}

.profile-editable-fact-view span {
    display: block !important;
    color: #667085 !important;
    font-size: 12px !important;
    font-weight: 800 !important;
    margin-bottom: 7px !important;
}

.profile-editable-fact-view strong {
    display: block !important;
    color: #173b2c !important;
    font-size: 14px !important;
    font-weight: 950 !important;
    word-break: break-word !important;
}

.profile-editable-fact .profile-icon-action.mini {
    position: absolute !important;
    top: 12px !important;
    left: 12px !important;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    padding: 0 !important;
    border-radius: 999px !important;
    border: 1px solid #d8d0c3 !important;
    background: #fff !important;
    color: #1f4a38 !important;
    font-size: 13px !important;
    display: grid !important;
    place-items: center !important;
    box-shadow: 0 8px 18px rgba(24,61,47,.06) !important;
}

.profile-editable-fact .profile-icon-action.mini:hover {
    background: #e8f4ed !important;
    border-color: #b7dfc8 !important;
}

.profile-editable-fact-editor {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto auto !important;
    gap: 8px !important;
    margin-top: 12px !important;
}

.profile-editable-fact-editor input {
    width: 100% !important;
    border: 1px solid #d8d0c3 !important;
    border-radius: 12px !important;
    padding: 11px 12px !important;
    font: inherit !important;
    background: #fff !important;
    box-sizing: border-box !important;
}

.profile-student-box .profile-facts {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
}

.profile-contact-actions {
    margin-top: 6px !important;
}

@media (max-width: 760px) {
    .profile-student-box .profile-facts,
    .profile-editable-fact-editor {
        grid-template-columns: 1fr !important;
    }

    .profile-editable-fact {
        padding-left: 14px !important;
        padding-top: 52px !important;
    }
}

/* PROFILE_SELF_STUDENT_EDIT_FIELDS_FINAL_V1 */
.profile-editable-fact {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0,1fr) auto;
    gap: 8px;
    align-items: center;
    border: 1px solid #eee7dc;
    background: #fff;
    border-radius: 12px;
    padding: 11px;
}

.profile-editable-fact-view span {
    display: block;
    color: #667085;
    font-size: 12px;
    margin-bottom: 4px;
}

.profile-editable-fact-view strong {
    color: #173b2c;
    word-break: break-word;
}

.profile-icon-action.mini {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    font-size: 14px;
}

.profile-editable-fact-editor {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0,1fr) auto auto;
    gap: 8px;
    margin-top: 8px;
}

.profile-editable-fact-editor[hidden] {
    display: none !important;
}

.profile-editable-fact-editor input {
    border: 1px solid #d8d0c3;
    border-radius: 12px;
    padding: 11px 12px;
    font: inherit;
    background: #fff;
}

@media (max-width: 760px) {
    .profile-editable-fact-editor {
        grid-template-columns: 1fr;
    }
}

/* PROFILE_EDITABLE_CONTACT_FIELDS_V1 */
@media (max-width: 760px) {
    .profile-contact-actions {
        display: grid;
    }
}

/* PROFILE_CONDITIONAL_SAVE_PASSWORD_TOGGLE_V1 */
.profile-save[hidden],
.profile-password-fields[hidden],
.profile-password-toggle[hidden] {
    display: none !important;
}

.profile-password-toggle {
    width: fit-content;
    margin-top: 8px;
}

.profile-password-fields {
    display: grid;
    gap: 12px;
    margin-top: 12px;
    animation: profileFadeIn .18s ease;
}

.profile-password-action {
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.profile-password-action small {
    width: 100%;
}

@keyframes profileFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}


/* PROFILE_NAME_PASSWORD_POLISH_V1 */
.profile-name-editor {
    display: grid;
    gap: 12px;
    border: 1px solid #eee7dc;
    background: #fbfaf7;
    border-radius: 16px;
    padding: 14px;
}

.profile-name-editor-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.profile-name-editor-head span {
    display: block;
    color: #667085;
    font-size: 12px;
    font-weight: 900;
    margin-bottom: 4px;
}

.profile-name-editor-head strong {
    color: #173b2c;
    font-size: 20px;
    font-weight: 950;
}

.profile-icon-action {
    width: 42px;
    height: 42px;
    border: 1px solid #d9d3c8;
    border-radius: 14px;
    background: #fff;
    color: #1f4a38;
    cursor: pointer;
    font-weight: 950;
}

.profile-icon-action:hover {
    background: #e8f4ed;
}

.profile-name-fields input:disabled {
    background: #f8fafc !important;
    color: #667085 !important;
}

.profile-name-fields input.is-editing {
    background: #fff !important;
    color: #173b2c !important;
    border-color: #1f4a38 !important;
    box-shadow: 0 0 0 3px rgba(31,74,56,.12) !important;
}

.profile-name-hint {
    color: #667085;
    font-size: 12px;
    font-weight: 800;
}

.profile-password-action {
    display: grid;
    align-content: end;
    gap: 8px;
}

.profile-password-action small {
    font-weight: 900;
    min-height: 18px;
}


/* PROFILE_ADMIN_TELEGRAM_FIELD_CLEAN_V1 */
.admin-student-admin-grid {
    display: grid;
    gap: 12px;
}

.profile-telegram-admin-label b {
    color: #0088cc;
    font-weight: 950;
}

.profile-telegram-admin-label small {
    color: #667085;
    font-size: 12px;
    line-height: 1.7;
    font-weight: 800;
}

.profile-telegram-admin-label input {
    text-align: left;
    direction: ltr;
}

.profile-telegram-action-box {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 10px 12px;
    border: 1px dashed #b8e4ff;
    background: #f7fbff;
    border-radius: 14px;
}

.profile-telegram-action-box span {
    color: #667085;
    font-size: 12px;
    font-weight: 900;
}

.profile-telegram-action-box .profile-action {
    background: #eaf7ff;
    border-color: #b8e4ff;
    color: #006699;
}

@media (max-width: 760px) {
    .profile-telegram-action-box {
        display: grid;
        justify-content: stretch;
    }

    .profile-telegram-action-box .profile-action {
        width: 100%;
    }
}

        .profile-page{display:grid;gap:18px;color:#173b2c}.profile-hero,.profile-card{background:#fff;border:1px solid #e6dfd2;border-radius:18px;box-shadow:0 16px 42px rgba(24,61,47,.06)}.profile-hero{position:relative;overflow:hidden;display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:18px;align-items:center;padding:24px}.profile-hero-bg{position:absolute;inset:0;background:linear-gradient(135deg,#1f4a38 0%,#173b2c 38%,#fff 38%);opacity:.08}.profile-photo{position:relative}.profile-photo img,.profile-initials{width:118px;height:118px;border-radius:28px;object-fit:cover;border:4px solid #fff;background:#e8f4ed;display:grid;place-items:center;font-size:34px;font-weight:900;color:#1f4a38;box-shadow:0 14px 28px rgba(24,61,47,.12)}.profile-role-pill{display:inline-flex;background:#e8f4ed;color:#1f7a4d;border-radius:999px;padding:6px 12px;font-weight:900;font-size:12px}.profile-hero h2{margin:10px 0 6px;font-size:34px;color:#173b2c}.profile-hero p{margin:0;color:#667085}.profile-hero-meta{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin-top:14px}.profile-hero-meta div,.profile-facts div,.profile-preferences div{background:#fbfaf7;border:1px solid #eee7dc;border-radius:12px;padding:11px}.profile-hero-meta small,.profile-facts span,.profile-preferences span{display:block;color:#667085;font-size:12px;margin-bottom:4px}.profile-hero-meta strong,.profile-facts strong,.profile-preferences strong{color:#173b2c;word-break:break-word}.profile-hero-actions{display:grid;gap:10px;position:relative}.profile-action,.profile-save,.profile-upload-button{border:1px solid #d9d3c8;border-radius:12px;background:#fff;color:#1f4a38;padding:11px 15px;font-weight:900;cursor:pointer;text-align:center;text-decoration:none}.profile-action.primary,.profile-save{background:#1f4a38;color:#fff;border-color:#1f4a38}.profile-action.danger{color:#b42318;background:#fff8f6}.profile-grid{display:grid;grid-template-columns:1.15fr .85fr;gap:16px}.profile-card{padding:18px;display:grid;gap:14px;align-content:start}.profile-section-head{display:flex;align-items:center;gap:10px}.profile-section-head span{width:34px;height:34px;border-radius:12px;background:#f2eadc;color:#9b6b1d;display:grid;place-items:center;font-weight:900}.profile-card h3{margin:0;font-size:20px}.profile-wide{grid-column:1/-1}.profile-two{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.profile-card label{display:grid;gap:7px;font-weight:900}.profile-card input{border:1px solid #d8d0c3;border-radius:12px;padding:12px;font:inherit;background:#fff}.profile-card input:disabled{background:#f8fafc;color:#667085}.profile-avatar-manager{display:grid;grid-template-columns:auto minmax(0,1fr);gap:14px;align-items:center;border:1px solid #eee7dc;background:#fbfaf7;border-radius:16px;padding:14px}.profile-avatar-manager p{margin:6px 0 12px;color:#667085}.profile-avatar-frame img,.profile-avatar-frame .profile-initials{width:88px;height:88px;border-radius:50%;object-fit:cover;border:3px solid #fff;background:#e8f4ed;box-shadow:0 10px 24px rgba(24,61,47,.12)}.profile-upload-row{display:flex;flex-wrap:wrap;gap:10px}.profile-save{width:fit-content}.profile-card small{color:#667085}.profile-facts,.profile-preferences{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.profile-security-box{border:1px dashed #d8d0c3;background:#fffdf8;border-radius:14px;padding:14px;display:grid;gap:10px}.profile-security-box p{margin:0;color:#667085}.profile-children{display:grid;gap:8px}.profile-children article{border:1px solid #eee7dc;background:#fbfaf7;border-radius:12px;padding:12px}.profile-children span{display:block;color:#667085;margin-top:4px}.profile-empty,.profile-loading{background:#fff;border:1px dashed #d8d0c3;border-radius:14px;padding:28px;text-align:center;color:#667085}.profile-readonly-note{background:#fff8eb;border:1px solid #f5d7a5;color:#8a5a0a;border-radius:14px;padding:13px;font-weight:900;line-height:1.7}.admin-student-edit-panel{border-color:#b7dfc8!important;background:linear-gradient(180deg,#fff,#f6fffa)!important}.admin-student-edit-help{margin:0;color:#667085;font-weight:800}.admin-student-note-label{display:grid!important;gap:7px}.admin-student-note-label textarea{min-height:110px;border:1px solid #d8d0c3;border-radius:12px;padding:12px;font:inherit;resize:vertical;background:#fff}.admin-student-edit-actions{display:flex;align-items:center;gap:12px;flex-wrap:wrap}.admin-student-edit-actions .danger{background:#fff5f5!important;color:#b42318!important;border-color:#fecaca!important}.admin-student-edit-actions small{font-weight:900}.profile-empty.error{color:#b42318}@media(max-width:900px){.profile-hero,.profile-grid,.profile-two,.profile-facts,.profile-preferences,.profile-hero-meta,.profile-avatar-manager{grid-template-columns:1fr}.profile-hero-actions{width:100%}}
