/* Subscriber portal visual layer. Cairo and all artwork are served locally. */
:root {
    --portal-accent: #587dde;
    --portal-accent-hover: #496dc9;
    --portal-accent-soft: #e9efff;
    --portal-page: #eff2f8;
    --portal-surface: #fff;
    --portal-surface-soft: #f8faff;
    --portal-text: #282b30;
    --portal-text-soft: #838da0;
    --portal-border: #e2e7f0;
    --portal-success: #309b73;
    --portal-danger: #d46b69;
    --portal-shadow: none;
}

body.user-page {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    min-height: 100vh;
    background: var(--portal-page);
    color: var(--portal-text);
}

.user-page .portal-header {
    position: sticky;
    top: 0;
    height: 100dvh;
    overflow-y: auto;
    align-self: start;
    background: #e6eaf1;
    border: 0;
    border-left: 1px solid #dce2ec;
    backdrop-filter: none;
}

.user-page .portal-header-inner {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    min-height: 100%;
    padding: 22px 12px 18px;
    gap: 0;
}

.user-page .portal-brand {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    padding: 0 6px 21px;
    text-align: center;
    color: #4c5568;
}

.user-page .portal-brand-icon {
    display: block;
    width: 148px;
    height: 80px;
    margin: auto;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.user-page .portal-brand-icon img { width: 100%; height: 100%; object-fit: contain; }
.user-page .portal-brand strong { font-size: 14px; color: #4a5568; }
.user-page .portal-brand small { font-size: 11px; color: #949eae; }

.user-page .portal-nav {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    margin: 0;
    gap: 4px;
}

.user-page .portal-nav-title {
    display: block;
    margin: 0 13px 9px;
    padding-top: 15px;
    border-top: 1px solid #d7dfeb;
    color: #909aab;
    font-size: 11px;
    font-weight: 700;
}

.user-page .portal-nav a {
    min-height: 48px;
    padding: 5px 8px;
    gap: 10px;
    border-radius: 16px;
    color: #566074;
    font-size: 13px;
    font-weight: 650;
    transition: background .18s, color .18s;
}

.user-page .portal-nav a .ui-icon {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    padding: 8px;
    border-radius: 10px;
    background: #f4f6fa;
}

.user-page .portal-nav a:hover { background: #dce3ef; color: #344d86; }
.user-page .portal-nav a.active { background: #dbe3f2; color: #344d86; }
.user-page .portal-nav a.active .ui-icon { background: #fff; }

.user-page .portal-sidebar-foot {
    display: grid;
    gap: 6px;
    margin-top: auto;
    padding: 16px 8px 0;
    border-top: 1px solid #d7dfeb;
    color: #8e98aa;
    font-size: 11px;
}

.user-page .portal-sidebar-foot a {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #526b9f;
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
}

.user-page .portal-sidebar-foot .ui-icon { width: 17px; height: 17px; }
.user-page .portal-main { min-width: 0; padding: 0 0 64px; }
.user-page .portal-topbar {
    position: sticky;
    top: 0;
    z-index: 19;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-height: 72px;
    padding: 10px clamp(20px, 3vw, 44px);
    border-bottom: 1px solid var(--portal-border);
    background: rgba(255,255,255,.96);
}

.user-page .portal-topbar-title { display: grid; gap: 2px; min-width: 0; }
.user-page .portal-topbar-title span { color: #9ba5b5; font-size: 11px; }
.user-page .portal-topbar-title strong { color: #364257; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-page .portal-topbar-actions { display: flex; gap: 8px; }
.user-page .portal-topbar-actions a {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 38px;
    padding: 8px 12px;
    border: 1px solid var(--portal-border);
    border-radius: 10px;
    background: #f8faff;
    color: #62718c;
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
}
.user-page .portal-topbar-actions a:hover { color: var(--portal-accent); background: #fff; }
.user-page .portal-topbar-actions .ui-icon { width: 16px; height: 16px; }

.user-page .portal-container {
    width: min(100%, 1320px);
    padding: 30px clamp(20px, 3vw, 44px);
    margin: auto;
}
.user-page .portal-page-head { align-items: center; margin-bottom: 23px; }
.user-page .portal-page-head h1 { color: #303b50; font-size: clamp(23px, 2vw, 30px); }
.user-page .portal-page-head p:not(.eyebrow) { color: #8a96a8; }
.user-page .eyebrow { color: var(--portal-accent) !important; }

.user-page .info-card,
.user-page .portal-panel,
.user-page .quick-action,
.user-page .plan-card,
.user-page .renew-plan-card,
.user-page .renew-review-item,
.user-page .renew-payment-card,
.user-page .payment-summary-card,
.user-page .payment-confirm-card,
.user-page .debt-summary-card,
.user-page .debt-item {
    border: 1px solid var(--portal-border);
    border-radius: 14px;
    background: #fff;
    box-shadow: none;
}

.user-page .dashboard-grid { grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.user-page .info-card { min-height: 96px; padding: 16px; }
.user-page .info-card-icon,
.user-page .renew-plan-icon,
.user-page .payment-summary-icon,
.user-page .debt-summary-icon { background: var(--portal-accent-soft); border-radius: 11px; }
.user-page .info-value { color: #35435a; }
.user-page .portal-panel { padding: 22px; }
.user-page .panel-head h2 { color: #35435a; }
.user-page .quick-actions { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.user-page .quick-action { min-height: 80px; padding: 15px; }
.user-page .quick-action:hover,
.user-page .plan-card:hover { transform: none; border-color: #bfcde8; background: #fcfdff; box-shadow: none; }
.user-page .subscription-placeholder,
.user-page .subscription-meta > div,
.user-page .renew-review-item,
.user-page .payment-result-details > div { background: #f8faff; border-color: #e7ebf3; }

.user-page .plans-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.user-page .plan-card { min-height: 0; padding: 20px; }
.user-page .plan-card.current { border-color: #b9c9ea; box-shadow: inset 0 3px 0 var(--portal-accent); }
.user-page .plan-spec-row { border-bottom-color: #edf0f6; }
.user-page .plan-action,
.user-page .portal-primary-link,
.user-page .portal-primary-button { background: var(--portal-accent); color: #fff; border-radius: 10px; }
.user-page .plan-action:hover,
.user-page .portal-primary-link:hover { background: var(--portal-accent-hover); }
.user-page .portal-secondary-button,
.user-page .portal-secondary-link { border: 1px solid #dbe2ee; border-radius: 10px; background: #fff; color: #5d6d87; }

.user-page input:not([type="checkbox"]):not([type="radio"]),
.user-page select,
.user-page textarea {
    max-width: 100%;
    border: 1px solid #dfe6f0;
    border-radius: 10px;
    background: #f9fbfe;
    color: #304057;
    font-family: var(--font-ui);
}
.user-page input:focus-visible,
.user-page select:focus-visible,
.user-page textarea:focus-visible,
.login-page input:focus-visible { outline: 2px solid #9db5ee; outline-offset: 2px; }
.user-page table { width: 100%; border-collapse: collapse; }
.user-page th { color: #748199; background: #f8faff; font-weight: 700; }
.user-page th, .user-page td { border-bottom: 1px solid #e9edf5; }
.user-page [hidden], .login-page [hidden] { display: none !important; }

.user-page .history-shell { width: 100%; }
.user-page .history-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.user-page .history-head h1 { margin: 3px 0 5px; color: #303b50; font-size: 27px; }
.user-page .history-head p { margin: 0; color: #8a96a8; }
.user-page .history-head .eyebrow { color: var(--portal-accent); }
.user-page .history-list { display: grid; gap: 12px; }
.user-page .history-card,
.user-page .history-empty { padding: 20px; border: 1px solid var(--portal-border); border-radius: 14px; background: #fff; }
.user-page .history-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.user-page .history-plan { color: #344057; font-size: 17px; font-weight: 700; }
.user-page .history-id { margin-top: 4px; color: #9ba5b5; font-size: 12px; }
.user-page .history-price { color: #344057; font-size: 20px; font-weight: 700; white-space: nowrap; }
.user-page .history-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px 22px; margin-top: 18px; padding-top: 16px; border-top: 1px solid #edf0f6; }
.user-page .history-field { display: flex; flex-direction: column; gap: 4px; }
.user-page .history-field span { color: #929cae; font-size: 12px; }
.user-page .history-field strong { font-size: 14px; }
.user-page .history-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.user-page .history-badge { display: inline-flex; align-items: center; padding: 7px 11px; border-radius: 999px; background: #edf2fc; color: #5570a6; font-size: 12px; font-weight: 650; }
.user-page .history-badge[data-status="paid"],
.user-page .history-badge[data-status="debt_paid"] { background: #e5f6ec; color: #267b56; }
.user-page .history-badge[data-status="debt_open"],
.user-page .history-badge[data-status="debt_partial"] { background: #fff3dc; color: #956d1c; }
.user-page .history-badge[data-status="failed"] { background: #fdebea; color: #b74f4c; }
.user-page .history-empty { padding: 45px 20px; text-align: center; }
.user-page .history-loading { padding: 24px 0; color: #929cae; }

body.login-page,
body.history-page,
body.payment-return-page { background: radial-gradient(circle at 15% 12%, #e2eafa, transparent 33%), radial-gradient(circle at 85% 85%, #e6effa, transparent 30%), #eff2f8; color: #344056; }
.login-page .login-shell { padding: 26px 18px; }
.login-page .login-stage { width: min(440px, 100%); }
.login-page .albarq-login-symbol { width: 200px; height: 104px; margin: 0 auto 24px; justify-content: center; }
.login-page .albarq-login-symbol img { width: 100%; height: 100%; max-height: 104px; }
.login-page .login-card { max-width: none; padding: 31px; border: 1px solid #e5eaf2; border-radius: 16px; box-shadow: 0 22px 60px rgba(53,77,122,.10); }
.login-page .login-heading { text-align: center; }
.login-page .login-heading h1 { color: #27354a; }
.login-page .login-heading p { color: #8a98ac; font-size: 13px; }
.login-page .login-input-wrap input { border-color: #e0e7f1; background: #f9fbfe; }
.login-page .portal-primary-button { background: var(--portal-accent); }
.login-page .login-help { border-color: #e7ecf5; background: #f8faff; }
.login-page .login-support { display: flex; align-items: center; justify-content: center; gap: 7px; width: max-content; max-width: 100%; margin: 16px auto 0; padding: 8px 14px; border: 1px solid #dce4f1; border-radius: 10px; background: #fff; color: #526b9f; text-decoration: none; font-size: 13px; font-weight: 700; }
.login-page .login-support img { width: 17px; height: 17px; }

.history-page .history-shell { width: min(100% - 36px, 1000px); margin: 32px auto 70px; }
.history-page .history-brand { display: block; width: 150px; height: 76px; margin: 0 auto 22px; }
.history-page .history-brand img { width: 100%; height: 100%; object-fit: contain; }
.history-page .history-head h1 { color: #344057; }
.history-page .history-card,
.history-page .history-empty { border-color: #e2e7f0; border-radius: 14px; box-shadow: none; }
.history-page .history-card { background: #fff; }
.history-page .history-badge { background: #edf2fc; color: #5570a6; }
.history-page .history-home { border: 1px solid #dce4f1; border-radius: 10px; background: #fff; color: #587dde; }

.payment-return-page .payment-result { max-width: 630px; margin: 40px auto; }
.payment-return-page .payment-brand { display: block; width: 180px; height: 90px; margin: 0 auto 22px; object-fit: contain; }
.payment-return-page .payment-card { border-color: #e2e7f0; border-radius: 16px; box-shadow: 0 18px 45px rgba(53,77,122,.08); }
.payment-return-page .payment-card h1 { color: #344057; }
.payment-return-page .payment-row { border-bottom: 1px solid #eff2f7; }
.payment-return-page .payment-actions .button { border-radius: 10px; background: var(--portal-accent); color: #fff; }

@media (max-width: 1000px) {
    body.user-page { grid-template-columns: 214px minmax(0,1fr); }
    .user-page .portal-header-inner { padding-inline: 8px; }
}

@media (max-width: 760px) {
    body.user-page { display: block; }
    .user-page .portal-header { position: sticky; top: 0; z-index: 30; height: auto; max-height: none; overflow: visible; border: 0; border-bottom: 1px solid #dce2ec; }
    .user-page .portal-header-inner { display: block; min-height: 0; padding: 9px 14px 7px; }
    .user-page .portal-brand { flex-direction: row; justify-content: flex-start; width: max-content; padding: 0; gap: 8px; text-align: right; }
    .user-page .portal-brand-icon { width: 76px; height: 39px; margin: 0; }
    .user-page .portal-brand strong { font-size: 12px; }
    .user-page .portal-brand small { display: block; font-size: 10px; }
    .user-page .portal-nav { display: flex; flex-direction: row; overflow-x: auto; overscroll-behavior-inline: contain; padding: 8px 0 2px; margin-top: 4px; gap: 5px; scrollbar-width: thin; }
    .user-page .portal-nav-title, .user-page .portal-sidebar-foot { display: none; }
    .user-page .portal-nav a { flex: 0 0 auto; min-height: 37px; padding: 4px 10px; gap: 6px; border-radius: 10px; font-size: 11px; }
    .user-page .portal-nav a .ui-icon { width: 22px; height: 22px; flex-basis: 22px; padding: 4px; border-radius: 6px; }
    .user-page .portal-nav a span { display: inline; }
    .user-page .portal-topbar { position: static; min-height: 53px; padding: 8px 17px; }
    .user-page .portal-topbar-title span { display: none; }
    .user-page .portal-topbar-title strong { font-size: 16px; }
    .user-page .portal-topbar-actions a { min-height: 32px; padding: 6px 8px; }
    .user-page .portal-topbar-actions a span { display: none; }
    .user-page .portal-container { width: 100%; padding: 20px 15px 45px; }
    .user-page .dashboard-grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; }
    .user-page .dashboard-grid .info-card { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 0; min-height: 99px; padding: 10px; }
    .user-page .dashboard-grid .info-card > div:last-child { min-width: 0; width: 100%; }
    .user-page .dashboard-grid .info-card-icon { width: 28px; height: 28px; }
    .user-page .dashboard-grid .info-card-icon img { width: 16px; height: 16px; }
    .user-page .dashboard-grid .info-label { font-size: 11px; line-height: 1.35; }
    .user-page .dashboard-grid .info-value { font-size: 13px; line-height: 1.35; overflow-wrap: anywhere; }
    .user-page .dashboard-grid #user-contract, .user-page .dashboard-grid #user-phone { direction: ltr; text-align: right; }
    .user-page .quick-actions { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .user-page .portal-page-head { align-items: stretch; }
}

@media (max-width: 530px) {
    .user-page .plans-grid { grid-template-columns: 1fr; }
    .user-page .quick-actions { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .user-page .quick-action { min-height: 90px; padding: 12px; gap: 8px; }
    .user-page .quick-action > img:last-child { display: none; }
    .user-page .quick-action strong { font-size: 12px; }
    .user-page .quick-action span { font-size: 10px; }
    .user-page .portal-panel { padding: 17px; }
    .user-page .portal-page-head { gap: 12px; }
    .user-page .portal-page-head h1 { font-size: 23px; }
    .user-page .history-head { align-items: flex-start; }
    .user-page .history-head h1 { font-size: 23px; }
    .user-page .history-grid { grid-template-columns: 1fr; }
    .login-page .login-card { padding: 24px 20px; }
    .login-page .albarq-login-symbol { width: 174px; height: 90px; margin-bottom: 18px; }
    .history-page .history-head { align-items: flex-start; }
    .payment-return-page .payment-result { margin-top: 20px; padding: 16px; }
    .payment-return-page .payment-card { padding: 20px; }
}

/* Compact subscriber dashboard and mobile navigation. */
.user-page-home {
    --portal-title-size: 18px;
    --portal-caption-size: 12px;
    --portal-detail-size: 14px;
}
.user-page-home .portal-page-head { margin-bottom: 14px; }
.user-page-home .portal-page-head h1 { font-size: 22px; line-height: 1.35; }
.user-page-home .portal-page-head p:not(.eyebrow) { font-size: var(--portal-caption-size); }
.user-page-home .portal-panel { padding: 16px; margin-bottom: 12px; }
.user-page-home .panel-head { margin-bottom: 11px; gap: 8px; }
.user-page-home .panel-head h2 { font-size: var(--portal-title-size); line-height: 1.4; }
.user-page-home .eyebrow,
.user-page-home .subscription-label,
.user-page-home .subscription-meta span,
.user-page-home .home-debt-label { font-size: var(--portal-caption-size); }
.user-page-home .subscription-details { grid-template-columns: minmax(140px,.7fr) minmax(0,2fr); gap: 12px; padding: 12px; }
.user-page-home .subscription-plan-name { font-size: var(--portal-title-size); line-height: 1.4; overflow-wrap: anywhere; }
.user-page-home .subscription-meta { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
.user-page-home .subscription-meta > div { min-width: 0; padding: 9px; }
.user-page-home .subscription-meta strong,
.user-page-home .home-debt-content p { font-size: var(--portal-detail-size); overflow-wrap: anywhere; }
.user-page-home .subscription-time { display: block; color: var(--portal-text-soft); font-size: var(--portal-caption-size); line-height: 1.45; }
.user-page-home .home-debt-content { padding: 12px; gap: 10px; }
.user-page-home .home-debt-value strong { font-size: 20px; }
.user-page-home .home-debt-content p { margin-bottom: 0; }
.user-page-home .portal-primary-link,
.user-page-home .portal-secondary-link { font-size: 12px; padding: 8px 10px; }
.user-page-home .home-installment-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.user-page-home .home-installment-grid>div { padding: 10px; }
.user-page .renew-debt-warning { margin-top: 12px; padding: 11px; border: 1px solid #f0c6c3; border-radius: 10px; background: #fff5f4; }
.user-page .renew-debt-warning p { margin: 0 0 9px; color: #a34440; font-size: 13px; }

@media (max-width: 760px) {
    .user-page .portal-header-inner { padding: 8px 12px; }
    .user-page .portal-brand { margin-inline: auto; justify-content: center; }
    .user-page .portal-nav {
        width: 100%; min-width: 0; overflow: visible; display: flex; flex-wrap: wrap;
        justify-content: center; align-items: stretch; gap: 5px; padding: 7px 0 0;
        margin: 5px 0 0; scrollbar-width: auto;
    }
    .user-page .portal-nav a {
        flex: 0 0 calc((100% - 15px)/4); box-sizing: border-box; min-width: 0;
        min-height: 53px; padding: 5px 2px; display: flex; flex-direction: column;
        align-items: center; justify-content: center; gap: 2px; text-align: center;
        font-size: 10px; line-height: 1.2;
    }
    .user-page .portal-nav a .ui-icon { width: 25px; height: 25px; flex: 0 0 25px; padding: 4px; }
    .user-page .portal-nav a span { display: block; width: 100%; white-space: normal; overflow-wrap: anywhere; }
    .user-page .portal-topbar { min-width: 0; }
    .user-page-home .portal-page-head { gap: 8px; }
    .user-page-home .subscription-details { display: block; padding: 0; background: transparent; border: 0; }
    .user-page-home .subscription-main { margin-bottom: 9px; }
    .user-page-home .subscription-meta { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .user-page-home .home-debt-content { flex-wrap: wrap; }
    .user-page-home .home-debt-content .portal-primary-link { width: auto; }
}

@media (max-width: 530px) {
    .user-page .portal-container { padding: 14px 12px 36px; }
    .user-page-home .portal-panel { padding: 11px; }
    .user-page-home .panel-head { margin-bottom: 7px; }
    .user-page-home .panel-head h2 { font-size: 17px; }
    .user-page-home .portal-page-head h1 { font-size: 20px; }
    .user-page-home .subscription-plan-name { font-size: 16px; }
    .user-page-home .subscription-main { margin-bottom: 6px; }
    .user-page-home .subscription-meta > div { padding: 5px 7px; }
    .user-page-home .subscription-meta strong { font-size: 13px; }
    .user-page-home .home-debt-content { padding: 9px; }
    .user-page-home .home-debt-value strong { font-size: 18px; }
    .user-page-plans .plans-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
    .user-page-plans .plan-card { min-width: 0; padding: 11px; }
    .user-page-plans .plan-card-head { display: block; margin-bottom: 8px; }
    .user-page-plans .plan-title-wrap h2 { font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; }
    .user-page-plans .plan-price { margin-top: 6px; text-align: right; }
    .user-page-plans .plan-price strong { font-size: 17px; }
    .user-page-plans .plan-description { min-height: 0; margin-bottom: 8px; font-size: 11px; line-height: 1.5; }
    .user-page-plans .plan-specs { gap: 4px; margin-bottom: 9px; }
    .user-page-plans .plan-spec-row { display: block; padding: 4px 0; font-size: 11px; }
    .user-page-plans .plan-spec-row span,
    .user-page-plans .plan-spec-row strong { display: block; overflow-wrap: anywhere; }
    .user-page-plans .plan-action { margin-top: auto; padding: 7px 3px; font-size: 11px; text-align: center; }
}
