:root {
    --hub-bg: #f4f7fb;
    --hub-surface: #ffffff;
    --hub-surface-soft: #f8fafc;
    --hub-border: #e3e8ef;
    --hub-text: #172033;
    --hub-muted: #667085;
    --hub-primary: #1769e0;
    --hub-primary-dark: #0f52ba;
    --hub-primary-soft: #eaf2ff;
    --hub-success: #128053;
    --hub-warning: #c86a13;
    --hub-danger: #c63e3e;
    --hub-shadow: 0 10px 28px rgba(20, 35, 60, .07);
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    color: var(--hub-text);
    background: var(--hub-bg);
}

html, body { margin: 0; min-height: 100%; background: var(--hub-bg); color: var(--hub-text); }
body { direction: rtl; }
.hub-shell { min-height: 100vh; background: var(--hub-bg); }

.hub-topbar {
    background: rgba(255,255,255,.97) !important;
    color: var(--hub-text) !important;
    border-bottom: 1px solid var(--hub-border);
    backdrop-filter: blur(12px);
    min-height: 68px !important;
    padding-inline: 18px !important;
}
.hub-topbar-context { display: flex; flex-direction: column; gap: 1px; }
.hub-topbar-title { font-weight: 700 !important; line-height: 1.2 !important; }
.hub-topbar-subtitle { color: var(--hub-muted) !important; }
.hub-topbar-badge {
    display: flex; align-items: center; gap: 7px; padding: 7px 12px;
    border: 1px solid #cfe0fb; border-radius: 999px; background: #f3f8ff;
    color: #245a9f; font-size: 12px; font-weight: 600;
}
.hub-menu-button { margin-inline-end: 4px; }

.hub-drawer {
    border-left: 1px solid var(--hub-border) !important;
    background: #fff !important;
}
.hub-drawer .mud-drawer-content { padding: 16px 12px 18px; display: flex; flex-direction: column; }
.hub-brand {
    display: flex; align-items: center; gap: 12px; padding: 4px 8px 20px;
    margin-bottom: 8px; border-bottom: 1px solid #eef1f5;
}
.hub-brand-mark {
    width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center;
    background: linear-gradient(135deg, var(--hub-primary), #4c91ef); color: #fff;
    font-weight: 800; letter-spacing: .5px; box-shadow: 0 8px 18px rgba(23,105,224,.22);
}
.hub-brand-name { font-size: 16px; font-weight: 800; color: #13213a; }
.hub-brand-caption { font-size: 11px; color: var(--hub-muted); letter-spacing: .2px; }
.hub-nav-caption { padding: 14px 14px 6px; color: #98a2b3; font-size: 11px; font-weight: 700; }
.hub-nav-menu .mud-nav-link {
    margin: 3px 0; min-height: 44px; border-radius: 11px; color: #475467;
    font-weight: 600; transition: background .16s ease, color .16s ease, transform .16s ease;
}
.hub-nav-menu .mud-nav-link:hover { background: #f4f7fb; color: #1d4f91; transform: translateX(-2px); }
.hub-nav-menu .mud-nav-link.active { background: var(--hub-primary-soft); color: var(--hub-primary); }
.hub-nav-menu .mud-nav-link.active .mud-nav-link-icon { color: var(--hub-primary); }
.hub-drawer-footer {
    margin-top: auto; display: flex; gap: 10px; align-items: center; padding: 12px 14px;
    border: 1px solid #dbe8f8; border-radius: 12px; background: #f8fbff; color: #2f5d96; font-size: 12px;
}
.hub-drawer-footer small { color: #7b8aa0; }

.hub-main { min-height: 100vh; background: var(--hub-bg); }
.hub-content { padding-top: 30px !important; padding-bottom: 44px !important; }
.hub-footer { text-align: center; color: #98a2b3; font-size: 11px; padding: 18px; }

.hub-main h1, .hub-main h2, .hub-main h3, .hub-main h4, .hub-main .mud-typography-h4 {
    color: #182230; letter-spacing: -.2px; font-weight: 750 !important;
}
.hub-main > .mud-container > .mud-stack:first-child,
.hub-main > .mud-container > .mud-typography-h4:first-child { margin-bottom: 18px; }

.hub-card {
    border-radius: 16px !important;
    border: 1px solid var(--hub-border);
    box-shadow: var(--hub-shadow) !important;
    background: var(--hub-surface) !important;
}
.hub-card:hover { border-color: #d4dce7; }

.hub-main .mud-paper:not(.mud-alert):not(.mud-popover):not(.mud-menu) {
    background-image: none;
}
.hub-main .mud-grid-item .hub-card > .mud-typography-h4 {
    color: var(--hub-primary); font-weight: 800 !important; margin-top: 6px;
}
.hub-main .mud-typography-body2, .hub-main .mud-typography-caption { color: var(--hub-muted); }

.hub-main .mud-button-root {
    border-radius: 10px; text-transform: none; font-weight: 650; min-height: 38px;
}
.hub-main .mud-button-filled-primary { box-shadow: 0 5px 12px rgba(23,105,224,.18); }
.hub-main .mud-input-control { margin-top: 2px; }
.hub-main .mud-input-outlined-border { border-color: #d8dee8 !important; }
.hub-main .mud-input-root:hover .mud-input-outlined-border { border-color: #aebacc !important; }
.hub-main .mud-input-root.mud-input-root-outlined.mud-input-root-margin-dense,
.hub-main .mud-input-root.mud-input-root-outlined { border-radius: 10px; background: #fff; }

.hub-main .mud-table-container {
    border: 1px solid #e6eaf0; border-radius: 13px; overflow: hidden; background: #fff;
}
.hub-main .mud-table-head .mud-table-cell {
    background: #f7f9fc; color: #475467; font-weight: 700; border-bottom: 1px solid #e6eaf0;
}
.hub-main .mud-table-row:hover { background: #f8fbff !important; }
.hub-main .mud-table-cell { border-color: #edf0f4; }

.hub-main .mud-alert { border-radius: 12px; box-shadow: none; }
.hub-main .mud-progress-linear { border-radius: 999px; overflow: hidden; }
.hub-main .mud-divider-root { border-color: #edf0f4; }
.ltr { direction: ltr; unicode-bidi: isolate; text-align: left; }

/* account state badges */
.hub-main .mud-chip { font-weight: 650; border-radius: 999px; }

/* login */
.hub-login-shell { min-height: calc(100vh - 170px); display: grid; place-items: center; }
.hub-login-card { width: min(100%, 480px); padding: 30px !important; }

@media (max-width: 960px) {
    .hub-topbar-badge { display: none; }
    .hub-content { padding-top: 22px !important; }
}
@media (max-width: 600px) {
    .hub-content { padding-inline: 12px !important; padding-top: 16px !important; }
    .hub-topbar { padding-inline: 8px !important; }
    .hub-topbar-subtitle { display: none; }
    .hub-card { border-radius: 13px !important; }
    .hub-main .mud-table-container { border-radius: 10px; }
}

/* V5 — professional account management and FastPro integration */
.hub-page-head {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 18px;
    margin-bottom: 24px; padding: 2px 2px 0;
}
.hub-page-head .mud-typography-h4 { margin: 3px 0 5px; }
.hub-eyebrow { color: var(--hub-primary); font-size: 10px; font-weight: 800; letter-spacing: 1.2px; direction: ltr; text-align: right; }

.hub-stat-card {
    min-height: 92px; padding: 17px 18px !important; display: flex; align-items: center; gap: 14px;
    box-shadow: 0 7px 20px rgba(20,35,60,.045) !important;
}
.hub-stat-card > div:last-child { display: flex; flex-direction: column; gap: 4px; }
.hub-stat-card span { color: var(--hub-muted); font-size: 12px; font-weight: 650; }
.hub-stat-card strong { color: #172033; font-size: 23px; line-height: 1; font-weight: 800; }
.hub-stat-icon { width: 45px; height: 45px; border-radius: 13px; display: grid; place-items: center; flex: 0 0 45px; }
.hub-stat-icon-primary { background: #eaf2ff; color: #1769e0; }
.hub-stat-icon-success { background: #e7f6ef; color: #128053; }
.hub-stat-icon-warning { background: #fff1df; color: #b86112; }
.hub-stat-icon-neutral { background: #eef1f5; color: #536174; }

.hub-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.hub-create-card { padding: 22px !important; }
.hub-form-action { display: flex; align-items: flex-start; padding-top: 8px; }
.hub-table-card { padding: 0 !important; overflow: hidden; }
.hub-table-headline { padding: 20px 22px 14px; margin: 0; border-bottom: 1px solid #edf0f4; }
.hub-table-card .mud-table-container { border: 0; border-radius: 0; }
.hub-live-dot { display: inline-flex; align-items: center; gap: 7px; color: #667085; font-size: 11px; font-weight: 700; }
.hub-live-dot > span { width: 8px; height: 8px; border-radius: 50%; background: #16a36a; box-shadow: 0 0 0 4px rgba(22,163,106,.12); }

.hub-account-name { display: flex; align-items: center; gap: 10px; }
.hub-account-avatar { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: #eef4ff; color: #1769e0; font-size: 12px; font-weight: 850; }
.hub-phone { font-weight: 700; color: #344054; }
.hub-row-actions { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.hub-fastpro-button { background: #152b4f !important; color: #fff !important; box-shadow: none !important; }
.hub-fastpro-button:hover { background: #203e6c !important; }
.hub-empty-table { min-height: 170px; display: flex; flex-direction: column; gap: 10px; align-items: center; justify-content: center; color: #98a2b3; }
.hub-empty-state { min-height: 300px; padding: 42px !important; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; }
.hub-empty-state > .mud-icon-root { color: #98a2b3; }

.hub-pairing-card { padding: 18px 20px !important; display: flex; align-items: center; gap: 16px; border-color: #cfe0fb !important; background: linear-gradient(135deg,#f7fbff,#fff) !important; }
.hub-pairing-icon { width: 50px; height: 50px; display: grid; place-items: center; border-radius: 14px; background: #e8f1ff; color: #1769e0; }
.hub-pairing-body { display: flex; flex-direction: column; gap: 3px; }
.hub-pairing-code { font-size: 26px; font-weight: 850; letter-spacing: 3px; color: #13213a; }

.hub-integration-card { padding: 0 !important; overflow: hidden; border-color: #d7e4f6 !important; box-shadow: 0 12px 32px rgba(23,105,224,.08) !important; }
.hub-integration-head {
    min-height: 78px; padding: 15px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
    background: linear-gradient(135deg,#10264a 0%,#183968 58%,#1d4f91 100%); color: #fff;
}
.hub-integration-head .mud-typography-root { color: #fff !important; }
.hub-integration-head .mud-typography-body2 { color: rgba(255,255,255,.72) !important; }
.hub-integration-head .mud-icon-button { color: #fff; }
.hub-integration-title { display: flex; align-items: center; gap: 13px; }
.hub-integration-logo { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 13px; background: rgba(255,255,255,.13); border: 1px solid rgba(255,255,255,.18); font-weight: 900; }
.hub-connection-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 1px; background: #edf1f6; border-bottom: 1px solid #e3e8ef; }
.hub-connection-field { background: #fff; padding: 15px 18px; min-width: 0; }
.hub-connection-field label { display: block; margin-bottom: 6px; color: #7b8798; font-size: 10px; font-weight: 800; direction: ltr; text-align: right; letter-spacing: .2px; }
.hub-connection-field > div { min-height: 32px; display: flex; align-items: center; gap: 4px; justify-content: space-between; color: #172033; font-size: 12px; font-weight: 700; min-width: 0; }
.hub-connection-field span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hub-connection-wide { grid-column: 1 / -1; }
.hub-mono { font-family: Consolas, "Cascadia Mono", monospace; font-size: 11px; }
.hub-secret-value { flex: 1; text-align: left; direction: ltr; }
.hub-boolean-on { display: inline-flex; padding: 4px 9px; border-radius: 999px; background: #e8f7ef; color: #128053; }
.hub-integration-actions { padding: 15px 18px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; background: #fbfcfe; }
.hub-integration-actions .mud-typography-caption { margin-inline-start: auto; }

@media (max-width: 760px) {
    .hub-page-head { flex-direction: column; }
    .hub-page-head > .mud-button-root { width: 100%; }
    .hub-connection-grid { grid-template-columns: 1fr; }
    .hub-connection-wide { grid-column: auto; }
    .hub-integration-actions .mud-button-root { width: 100%; }
    .hub-integration-actions .mud-typography-caption { margin-inline-start: 0; width: 100%; }
    .hub-row-actions { align-items: stretch; }
    .hub-row-actions .mud-button-root { flex: 1 1 42%; }
}

/* V5 — dashboard + messaging workspace */
.hub-stat-name { font-size: 14px !important; line-height: 1.35 !important; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hub-empty-illustration { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; background: #eaf2ff; color: var(--hub-primary); }
.hub-quick-card { padding: 18px !important; display: flex; flex-direction: column; gap: 7px; }
.hub-quick-card > .mud-typography-h6 { margin-bottom: 5px; }
.hub-quick-link { display: flex; align-items: center; justify-content: space-between; min-height: 48px; padding: 10px 12px; border: 1px solid #e8edf4; border-radius: 11px; background: #fbfcfe; color: #344054; text-decoration: none; transition: .16s ease; }
.hub-quick-link:hover { border-color: #c8d9ef; background: #f5f9ff; color: #1769e0; transform: translateX(-2px); }
.hub-quick-link > span { display: flex; align-items: center; gap: 9px; font-weight: 700; }
.hub-quick-link .mud-icon-root { font-size: 20px; }
.hub-quick-link > strong { direction: ltr; font-size: 18px; }

.hub-message-compose { padding: 22px !important; min-height: 100%; }
.hub-compose-icon, .hub-guide-icon { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; background: #eaf2ff; color: #1769e0; }
.hub-message-guide { padding: 22px !important; min-height: 100%; background: linear-gradient(150deg,#fbfdff,#f5f9ff) !important; }
.hub-message-guide > .mud-typography-h6 { margin: 14px 0 15px; }
.hub-guide-step { display: flex; gap: 11px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid #e8edf4; }
.hub-guide-step:last-of-type { border-bottom: 0; margin-bottom: 12px; }
.hub-guide-step > b { width: 27px; height: 27px; border-radius: 9px; display: grid; place-items: center; background: #172f57; color: #fff; font-size: 11px; flex: 0 0 27px; }
.hub-guide-step > span { display: flex; flex-direction: column; gap: 2px; }
.hub-guide-step strong { color: #243a5a; font-size: 12px; direction: ltr; text-align: right; }
.hub-guide-step small { color: #7b8798; font-size: 11px; }
.hub-latest-message { padding: 20px !important; border-inline-start: 4px solid #1769e0 !important; }
.hub-latest-message .hub-section-head { margin-bottom: 12px; }

@media (max-width: 600px) {
    .hub-page-head .mud-stack-root { width: 100%; }
    .hub-page-head .mud-stack-root .mud-button-root { flex: 1; }
    .hub-quick-card { padding: 14px !important; }
    .hub-message-compose, .hub-message-guide { padding: 16px !important; }
}

/* V5 — login */
.hub-login-shell { min-height: calc(100vh - 170px); display: grid; place-items: center; padding: 24px 0; }
.hub-login-panel { width: min(100%, 930px); display: grid; grid-template-columns: .92fr 1.08fr; overflow: hidden; padding: 0 !important; min-height: 510px; }
.hub-login-brand-panel { padding: 44px 38px; color: #fff; background: radial-gradient(circle at 20% 20%, rgba(58,132,230,.36), transparent 34%), linear-gradient(145deg,#0e2344,#17355f 58%,#1e4e8d); display: flex; flex-direction: column; justify-content: center; }
.hub-login-brand-mark { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 16px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18); font-size: 18px; font-weight: 900; margin-bottom: 22px; }
.hub-login-eyebrow { color: #9bc4ff !important; text-align: right; margin-bottom: 8px; }
.hub-login-brand-panel h1 { color: #fff !important; font-size: 31px; line-height: 1.45; margin: 0 0 14px; font-weight: 850; }
.hub-login-brand-panel p { color: rgba(255,255,255,.72); font-size: 13px; line-height: 1.9; margin: 0 0 25px; max-width: 320px; }
.hub-login-feature { display: flex; align-items: center; gap: 9px; color: rgba(255,255,255,.86); font-size: 12px; margin: 7px 0; }
.hub-login-feature .mud-icon-root { color: #84bcff; font-size: 20px; }
.hub-login-form-panel { padding: 54px 48px; display: flex; flex-direction: column; justify-content: center; background: #fff; }
.hub-login-form-head { margin-bottom: 25px; }
.hub-login-form-head .mud-typography-h4 { margin-bottom: 6px; }
.hub-login-submit { min-height: 46px !important; }
.hub-login-note { display: flex; align-items: flex-start; gap: 7px; color: #8a94a5; font-size: 11px; line-height: 1.6; margin-top: 18px; }
.hub-login-note .mud-icon-root { margin-top: 1px; }
@media (max-width: 800px) {
    .hub-login-panel { grid-template-columns: 1fr; width: min(100%, 560px); }
    .hub-login-brand-panel { display: none; }
    .hub-login-form-panel { padding: 34px 24px; }
}
.hub-plan-card { padding: 22px !important; position: relative; overflow: hidden; }
.hub-plan-card::before { content: ""; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 4px; background: linear-gradient(#1769e0,#6ca8f2); }
.hub-plan-card .mud-typography-h5 { color: #1769e0; font-weight: 850 !important; }
