:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #172033;
  background: #f3f5f9;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --navy: #111827;
  --blue: #1800ad;
  --green: #39ff14;
  --muted: #748096;
  --border: #e4e8f0;
  --surface: #fff;
}

@font-face {
  font-family: "Jameel Noori Nastaleeq";
  src: url("./Jameel Noori Nastaleeq Kasheeda.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: #f3f5f9; }
html[dir="rtl"] body { font-family: "Jameel Noori Nastaleeq", serif; line-height: 1.9; }
button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.app-shell { min-height: 100vh; }
.topbar { position: relative; height: 68px; padding: 0 max(22px, calc((100% - 1120px) / 2)); background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: center; }
.brand { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: inline-flex; flex-direction: column; gap: 2px; align-items: center; color: #fff; text-decoration: none; font-weight: 800; letter-spacing: -.3px; }
.brand img { display: block; width: auto; height: 34px; max-width: 180px; object-fit: contain; }
.brand small { display: block; color: #aeb8cc; font-size: 8px; letter-spacing: 2px; }
.brand-mark { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; color: var(--navy); font-size: 20px; font-weight: 900; background: var(--green); }
.top-actions { position: absolute; right: max(22px, calc((100% - 1120px) / 2)); top: 50%; display: flex; gap: 10px; align-items: center; transform: translateY(-50%); }
.language-button { min-width: 46px; height: 34px; padding: 0 9px; border: 1px solid #354258; border-radius: 9px; color: #fff; background: #1c2739; font-size: 11px; font-weight: 800; }
.connection { position: absolute; left: max(22px, calc((100% - 1120px) / 2)); top: 50%; display: inline-flex; align-items: center; gap: 7px; transform: translateY(-50%); color: #cbd5e1; font-size: 12px; }
.connection i { width: 8px; height: 8px; background: #f59e0b; border-radius: 50%; }
.connection.online i { background: #39ff14; }
.connection.offline i { background: #ff0101; }
.icon-button { border: 1px solid #354258; background: #1c2739; color: #fff; border-radius: 9px; min-width: 38px; height: 38px; font-size: 19px; }
main { width: min(1120px, calc(100% - 36px)); margin: 0 auto; padding: 34px 0 56px; }
.login-view { min-height: calc(100vh - 136px); display: grid; place-items: center; }
.login-card { width: min(100%, 430px); background: var(--surface); padding: 34px; border: 1px solid var(--border); border-radius: 20px; box-shadow: 0 18px 55px #1a25400d; }
.login-badge,.eyebrow { color: var(--blue); font-weight: 800; letter-spacing: 1.7px; font-size: 10px; }
h1,h2,p { margin-top: 0; }
.login-card h1 { margin: 10px 0 6px; font-size: 29px; letter-spacing: -1px; }
.login-card > p,.section-heading p,.welcome-row p { color: var(--muted); font-size: 13px; }
form label { display: block; margin: 18px 0 7px; color: #475269; font-size: 12px; font-weight: 700; }
input { width: 100%; min-height: 46px; padding: 11px 13px; color: #172033; border: 1px solid #dce2ec; border-radius: 10px; outline: none; background: #fff; }
input:focus { border-color: #7669d8; box-shadow: 0 0 0 3px #1800ad15; }
.button { border: 0; border-radius: 10px; min-height: 42px; padding: 0 16px; font-weight: 750; font-size: 13px; }
.button.primary { color: white; background: var(--blue); }
.button.primary:hover { background: #2a13c7; }
.button.secondary { color: #24314a; background: #edf0f7; border: 1px solid var(--border); }
.button.wide { width: 100%; margin-top: 22px; min-height: 48px; }
.login-help { margin: 22px 0 0; padding-top: 17px; border-top: 1px solid var(--border); color: var(--muted); font-size: 11px; text-align: center; }
.form-error { min-height: 16px; margin: 10px 0 0; color: #d33b41; font-size: 12px; }
.welcome-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 3px 0 24px; }
.welcome-row h1 { margin: 6px 0 4px; font-size: clamp(24px, 4vw, 33px); letter-spacing: -1.2px; }
.welcome-row p { margin-bottom: 0; }
.location-button { white-space: nowrap; }
.offer-banner { min-height: 50px; display: flex; gap: 10px; align-items: center; padding: 12px 15px; margin-bottom: 18px; border-radius: 12px; color: #214e36; background: #e7faef; border: 1px solid #c0efd0; font-size: 13px; }
.offer-banner > span:last-child { margin-left: auto; font-weight: 800; }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: #1ca65a; box-shadow: 0 0 0 5px #1ca65a20; }
.tabs { display: flex; overflow: auto; gap: 5px; padding: 5px; border: 1px solid var(--border); background: #e9edf4; border-radius: 13px; }
.tab { position: relative; flex: 1 0 auto; border: 0; border-radius: 9px; padding: 11px 15px; color: #637087; background: transparent; font-size: 12px; font-weight: 750; }
.tab.active { color: #1c2850; background: #fff; box-shadow: 0 2px 6px #15243b12; }
.tab-count { margin-left: 4px; min-width: 19px; display: inline-block; border-radius: 9px; color: var(--blue); background: #eeebff; padding: 2px 5px; }
.unread-dot { position: absolute; top: 8px; right: 12px; width: 7px; height: 7px; background: #e54b52; border-radius: 50%; }
.tab-panel { display: none; padding-top: 28px; }
.tab-panel.active { display: block; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 17px; }
.section-heading h2 { margin: 0 0 4px; font-size: 20px; letter-spacing: -.4px; }
.section-heading p { margin: 0; }
.text-button { color: var(--blue); background: none; border: 0; font-weight: 700; font-size: 12px; white-space: nowrap; }
.cards { display: grid; gap: 14px; }
.order-card,.profile-card,.wallet-card,.chat-box,.loading-card,.empty-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.order-card { padding: 19px; }
.order-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.order-number { color: #28334b; font-size: 14px; font-weight: 800; }
.order-service { margin: 4px 0 0; font-size: 18px; font-weight: 800; }
.status { display: inline-flex; border-radius: 100px; padding: 6px 9px; font-size: 10px; font-weight: 800; white-space: nowrap; color: #80530a; background: #fff4d4; }
.status.accepted,.status.complete,.status.completed { color: #17653c; background: #e3f8eb; }
.order-details { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; margin-top: 17px; padding-top: 15px; border-top: 1px solid #eef0f4; }
.detail-label { display: block; margin-bottom: 5px; color: var(--muted); font-size: 10px; }
.detail-value { color: #29364e; font-size: 12px; font-weight: 700; line-height: 1.45; overflow-wrap: anywhere; }
.order-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 17px; }
.expires { color: #b65b16; font-size: 11px; font-weight: 700; }
.order-actions { display: flex; gap: 8px; }
.active-order-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.active-order-heading .order-number { margin-top: 7px; }
.active-order-heading .order-service { font-size: 20px; }
.countdown-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; margin-top: 17px; }
.countdown-card { padding: 14px; border: 1px solid #e8eaf3; border-radius: 12px; background: #f8f8ff; }
.countdown-card span,.countdown-card small { display: block; color: var(--muted); font-size: 10px; }
.countdown-card strong { display: block; margin: 6px 0; color: #241783; font-size: 20px; }
.countdown-card small { line-height: 1.4; }
.active-customer-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; margin-top: 17px; padding: 16px 0; border-top: 1px solid #eef0f4; border-bottom: 1px solid #eef0f4; }
.active-customer-grid strong { display: block; color: #29364e; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.contact-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.contact-actions a { display: inline-flex; align-items: center; text-decoration: none; }
.review-pending { display: inline-block; padding: 8px 10px; border-radius: 9px; color: #80530a; background: #fff4d4; font-size: 11px; font-weight: 700; }
.active-order-actions { justify-content: flex-end; flex-wrap: wrap; margin-top: 15px; }
.button.reject { color: #617087; background: #f0f2f6; }
.button.accept { color: #163d27; background: var(--green); }
.button:disabled { cursor: wait; opacity: .6; }
.loading-card,.empty-card { padding: 26px; color: var(--muted); text-align: center; font-size: 13px; }
.empty-card strong { display: block; color: #32405a; margin-bottom: 5px; }
.filter-row { display: flex; gap: 7px; margin: 0 0 14px; }
.filter { border: 1px solid var(--border); border-radius: 30px; padding: 7px 12px; color: #66738a; background: #fff; font-size: 11px; font-weight: 700; }
.filter.active { border-color: #c9c1ff; color: var(--blue); background: #f0edff; }
.wallet-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 13px; margin-bottom: 17px; }
.wallet-card { padding: 20px; }
.wallet-balance-card { border-color: #c9c1ff; background: #f5f3ff; }
.wallet-card span { display: block; color: var(--muted); font-size: 11px; }
.wallet-card strong { display: block; margin-top: 9px; font-size: clamp(20px,4vw,27px); letter-spacing: -.8px; }
.wallet-note { color: var(--muted); font-size: 11px; line-height: 1.6; }
.payment-list { margin-top: 8px; }
.payment-row { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-top: 1px solid #eef0f4; font-size: 12px; }
.payment-row small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.payment-row > b { white-space: nowrap; }
.commission-history-card { margin-top: 13px; padding: 0; overflow: hidden; }
.commission-history-toggle { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 17px 19px; border: 0; color: #172033; background: linear-gradient(110deg, #fff, #f8f7ff); text-align: left; }
.commission-history-title strong,.commission-history-title small { display: block; }
.commission-history-title strong { font-size: 15px; }
.commission-history-title small { margin-top: 5px; color: var(--muted); font-size: 11px; font-weight: 500; }
.commission-history-toggle-label { display: inline-flex; align-items: center; gap: 8px; color: var(--blue); font-size: 11px; font-weight: 800; white-space: nowrap; }
.commission-history-toggle-label b { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--blue); font-size: 17px; }
.commission-history-content { padding: 0 15px 15px; }
.commission-cards,.document-list { display: grid; gap: 10px; }
.commission-order-card { position: relative; padding: 14px; border: 1px solid #e6e9f1; border-radius: 13px; background: #fff; box-shadow: 0 3px 12px #17203308; }
.commission-order-card.is-paid { border-color: #d3ecdc; background: linear-gradient(110deg, #fff, #fbfffc); }
.commission-card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding-right: 2px; }
.commission-service-copy { min-width: 0; }
.commission-service-copy strong { display: block; padding-right: 2px; color: #1d2940; font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; }
.commission-service-copy span { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; line-height: 1.4; }
.commission-stamp { flex: 0 0 auto; display: inline-flex; align-items: center; padding: 5px 8px; transform: rotate(5deg); border: 1px solid #f0c77c; border-radius: 5px; color: #89570b; background: #fff8e9; font-size: 9px; font-weight: 900; line-height: 1.2; text-transform: uppercase; }
.commission-stamp.paid { transform: rotate(-5deg); border-color: #8acba0; color: #17653c; background: #effbf3; }
.commission-card-amounts { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 7px; margin-top: 13px; }
.commission-card-amounts > div { min-width: 0; padding: 9px 8px; border: 1px solid #edf0f5; border-radius: 9px; background: #fafbfe; }
.commission-card-amounts small,.commission-card-amounts strong { display: block; }
.commission-card-amounts small { margin-bottom: 5px; color: var(--muted); font-size: 9px; }
.commission-card-amounts strong { color: #29364e; font-size: 11px; overflow-wrap: anywhere; }
.commission-card-amounts .amount-due { border-color: #f0d7b4; background: #fffaf3; }
.commission-card-amounts .amount-due strong { color: #a45d0b; }
.commission-card-note { margin: 9px 0 0; color: var(--muted); font-size: 10px; }
.commission-slip-pending { margin-top: 10px; padding: 8px 10px; border-radius: 8px; color: #80530a; background: #fff4d4; font-size: 10px; font-weight: 750; }
.commission-order-card .payment-slip-form { margin-top: 11px; padding-top: 11px; border-top: 1px solid #eef0f4; }
.commission-pagination { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 13px; color: var(--muted); font-size: 10px; }
.commission-pagination > div { display: flex; align-items: center; gap: 8px; }
.commission-pagination .button { min-height: 34px; padding: 0 10px; font-size: 10px; }
.commission-page-number { min-width: 36px; text-align: center; color: #29364e; font-weight: 800; }
.documents-card h3 { margin: 0 0 13px; font-size: 15px; }
.payment-slip-form { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px 12px; width: min(100%, 520px); }
.payment-slip-form label,.document-upload-form label { margin: 0; color: #475269; font-size: 10px; font-weight: 700; }
.payment-slip-form input,.document-upload-form input { display: block; min-height: 38px; margin-top: 5px; padding: 8px; font-size: 10px; }
.payment-slip-form button { grid-column: 1 / -1; justify-self: start; }
.profile-card { padding: 20px; }
.performance-card { margin-top: 14px; }
.performance-card h3 { margin: 0 0 16px; font-size: 15px; }
.performance-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 15px; }
.profile-header { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; padding-bottom: 17px; border-bottom: 1px solid #eef0f4; }
.profile-header img,.profile-placeholder { width: 52px; height: 52px; flex: 0 0 52px; border-radius: 50%; object-fit: cover; background: #e9e7ff; }
.profile-placeholder { display: grid; place-items: center; color: var(--blue); font-size: 19px; font-weight: 800; }
.profile-header strong,.profile-header small { display: block; }
.profile-header strong { font-size: 15px; }
.profile-header small { margin-top: 5px; color: var(--muted); font-size: 10px; }
.profile-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; }
.password-card { margin-top: 14px; padding: 20px; }
.password-card h3 { margin: 0 0 6px; font-size: 15px; }
.password-form { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px 14px; margin-top: 14px; }
.password-form label { align-self: end; font-size: 12px; font-weight: 700; }
.password-form input { width: 100%; min-width: 0; padding: 11px 12px; border: 1px solid var(--border); border-radius: 9px; font: inherit; }
.password-form button { grid-column: 1 / -1; justify-self: start; }
.profile-item span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 10px; }
.profile-item strong { font-size: 13px; overflow-wrap: anywhere; }
.documents-card { margin-top: 14px; }
.document-row { display: grid; grid-template-columns: minmax(120px,1fr) minmax(190px,2fr) auto; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid #eef0f4; }
.document-row > span,.document-row > label { color: #475269; font-size: 11px; font-weight: 700; }
.document-row a { justify-self: start; text-decoration: none; }
.document-row .review-pending { justify-self: start; }
.workdone-dialog { width: min(460px, calc(100% - 28px)); padding: 0; border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 20px 70px #17203340; }
.workdone-dialog::backdrop { background: #11182780; }
.workdone-dialog form { padding: 22px; }
.workdone-dialog h2 { margin: 0 0 7px; font-size: 19px; }
.workdone-dialog p { color: var(--muted); font-size: 12px; line-height: 1.5; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.chat-box { overflow: hidden; }
.chat-messages { height: min(54vh, 500px); min-height: 250px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 16px; background: #f9fafc; }
.message { align-self: flex-start; max-width: min(82%, 500px); padding: 10px 12px; border-radius: 12px 12px 12px 3px; color: #2a354a; background: #fff; border: 1px solid var(--border); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.message.mine { align-self: flex-end; color: #fff; background: var(--blue); border-color: var(--blue); border-radius: 12px 12px 3px 12px; }
.message-meta { display: block; margin-top: 5px; opacity: .68; font-size: 9px; }
.chat-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); background: #fff; }
.chat-form input { min-width: 0; }
.chat-file { flex: 0 0 115px; max-width: 125px; padding: 8px; font-size: 10px; }
.chat-record { flex: 0 0 42px; min-width: 42px; padding: 0; }
.chat-attachment { display: block; max-width: min(100%, 260px); max-height: 260px; margin: 7px 0; border-radius: 9px; object-fit: contain; }
.chat-attachment-audio { display: block; width: min(260px, 100%); margin: 7px 0; }
.chat-order-ref { display: block; margin: 6px 0; padding: 5px 8px; border: 1px solid #d9dcf4; border-radius: 7px; color: var(--blue); background: #f2f1ff; font-size: 10px; font-weight: 800; }
.chat-media-error { color: #b42318; font-size: 10px; }
.performance-grid .profile-item { padding: 10px; border: 1px solid #eef0f4; border-radius: 10px; background: #fafbfe; }
html[dir="rtl"] .chat-messages { text-align: right; }
.profile-signout { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 14px; padding: 16px 19px; border: 1px solid var(--border); border-radius: 14px; background: #fff; }
.profile-signout strong,.profile-signout small { display: block; }
.profile-signout strong { color: #29364e; font-size: 12px; }
.profile-signout small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.profile-signout button { flex: 0 0 auto; color: #9c2c32; background: #fff1f1; border: 1px solid #f5d4d5; }
.toast { position: fixed; z-index: 20; bottom: calc(20px + env(safe-area-inset-bottom)); left: 50%; max-width: calc(100% - 32px); padding: 12px 17px; transform: translate(-50%, 18px); opacity: 0; pointer-events: none; border-radius: 10px; color: #fff; background: #182238; box-shadow: 0 8px 26px #15223a30; font-size: 12px; transition: .2s ease; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 680px) {
  .topbar { height: 60px; padding: 0 16px; }
  .top-actions { right: 14px; gap: 7px; }
  .connection { left: 14px; gap: 0; }
  .brand img { height: 29px; max-width: 115px; }
  .brand small { font-size: 7px; }
  .connection { font-size: 0; }
  .connection i { flex: 0 0 8px; }
  main { width: min(100% - 24px, 520px); padding: 23px 0 calc(32px + env(safe-area-inset-bottom)); }
  .login-view { min-height: calc(100dvh - 110px); }
  .login-card { padding: 26px 21px; border-radius: 16px; }
  .welcome-row { align-items: flex-start; flex-direction: column; gap: 13px; margin-bottom: 19px; }
  .location-button { align-self: stretch; }
  .tabs { gap: 2px; }
  .tab { padding: 10px 11px; font-size: 11px; }
  .tab-panel { padding-top: 22px; }
  .order-card { padding: 15px; }
  .order-details { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .order-footer { align-items: flex-start; flex-direction: column; }
  .order-actions { width: 100%; }
  .order-actions .button { flex: 1; }
  .active-order-actions { justify-content: stretch; }
  .active-order-actions .button { flex: 1 1 135px; }
  .countdown-grid { gap: 8px; }
  .countdown-card { padding: 11px; }
  .countdown-card strong { font-size: 17px; }
  .commission-history-toggle { align-items: flex-start; padding: 15px 13px; }
  .commission-history-title strong { font-size: 13px; }
  .commission-history-title small { max-width: 230px; line-height: 1.5; }
  .commission-history-toggle-label { font-size: 0; }
  .commission-history-toggle-label b { font-size: 17px; }
  .commission-history-content { padding: 0 10px 12px; }
  .commission-order-card { padding: 12px; }
  .commission-service-copy strong { font-size: 13px; }
  .commission-stamp { max-width: 95px; white-space: normal; text-align: center; }
  .commission-card-amounts { gap: 5px; }
  .commission-card-amounts > div { padding: 8px 6px; }
  .commission-card-amounts strong { font-size: 10px; }
  .commission-pagination { align-items: flex-start; flex-direction: column; }
  .commission-pagination > div { width: 100%; justify-content: space-between; }
  .payment-slip-form { width: 100%; }
  .document-row { grid-template-columns: 1fr; align-items: stretch; }
  .document-row .review-pending,.document-row a { justify-self: start; }
  .wallet-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
  .wallet-card { padding: 16px; }
  .wallet-card strong { margin-top: 5px; }
  .profile-grid { gap: 16px 10px; }
  .password-form { grid-template-columns: 1fr; }
  .performance-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .chat-form { flex-wrap: wrap; }
  .chat-file { flex: 1 1 100%; max-width: 100%; }
  .section-heading { align-items: flex-start; }
  .profile-signout { align-items: flex-start; padding: 14px; }
}
