.clients-page { background: #f5f6f7; color: #454649; }
.clients-page [hidden] { display: none !important; }
.clients-header { display: flex; align-items: center; gap: 25px; padding: 19px max(24px, calc((100vw - 1320px) / 2)); background: #fff; border-bottom: 1px solid #e0e2e5; flex-wrap: wrap; }
.clients-brand { display: flex; align-items: center; gap: 12px; color: #58595b; text-decoration: none; }
.clients-brand img { width: 150px; height: 58px; object-fit: contain; }
.clients-brand span { font-size: 15px; font-weight: 600; }
.clients-brand small { display: block; font-size: 9px; letter-spacing: .7px; color: #909398; margin-top: 3px; }
.clients-header nav { display: flex; gap: 4px; flex-wrap: wrap; }
.clients-header nav a { color: #66696d; text-decoration: none; font-size: 12px; padding: 9px 11px; border-radius: 6px; }
.clients-header nav a[aria-current] { background: #fff4da; color: #8b651b; }
.clients-auth { margin-inline-start: auto; display: flex; align-items: center; gap: 9px; font-size: 11px; flex-wrap: wrap; }
.clients-auth .button { min-height: 35px; font-size: 11px; }
.clients-workspace { max-width: 1280px; margin: auto; padding: 32px 24px 60px; }
.clients-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.clients-heading h1 { font-size: clamp(25px, 3vw, 34px); font-weight: 600; margin: 5px 0 7px; }
.clients-heading p:not(.eyebrow) { font-size: 13px; color: #85898e; }
.clients-notice { background: #fff9ed; border: 1px solid #ecd4a2; border-inline-start: 4px solid #f5b427; padding: 13px 16px; border-radius: 8px; font-size: 12px; line-height: 1.9; margin-bottom: 17px; }
.clients-warning { background: #fff3ed; border-color: #e5b9a3; }
.clients-message { font-size: 12px; min-height: 24px; line-height: 1.9; margin-bottom: 8px; }
.clients-message.error, #portal-error { color: #a83d36; }
.save-message { padding: 10px 13px; margin-top: -6px; margin-bottom: 17px; border: 1px solid #e1e4e7; border-radius: 8px; background: #fff; overflow-wrap: anywhere; }
.save-message.error { background: #fff3ed; border-color: #e5b9a3; border-inline-start: 4px solid #a83d36; }
.clients-muted { color: #85898e; font-size: 12px; line-height: 1.9; }
.directory-tools { display: flex; align-items: center; gap: 12px; margin-bottom: 17px; }
.directory-tools .search-box { flex: 1; max-width: 650px; }
.directory-tools .search-box > span { font-size: 12px; color: #8f9398; }
.directory-tools .client-type-filter { min-width: 180px; }
.client-type-badge { display: inline-block; color: #866328; background: #fff7e7; border-radius: 5px; padding: 4px 8px; font-size: 11px; margin-top: 10px; }
.client-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 15px; }
.client-card { text-align: start; background: #fff; border: 1px solid #e2e4e6; border-radius: 12px; padding: 23px; min-width: 0; box-shadow: 0 3px 13px #33353804; transition: border-color .15s, transform .15s; }
.client-card:hover { border-color: #d0b16a; transform: translateY(-2px); }
.client-card:focus-visible { outline: 3px solid #f5b427; outline-offset: 3px; }
.client-card .card-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.client-card .client-mark { width: 36px; height: 36px; background: #fff5dd; display: grid; place-items: center; border-radius: 8px; color: #ab822b; }
.client-card h2 { font-size: 19px; margin: 18px 0 8px; overflow-wrap: anywhere; }
.client-card p { font-size: 12px; color: #81868c; margin: 4px 0; overflow-wrap: anywhere; }
.client-card b[dir] { font-size: 12px; color: #9a7631; font-family: Manrope, monospace; }
.card-bottom { display: flex; justify-content: space-between; gap: 10px; border-top: 1px solid #eef0f2; padding-top: 12px; margin-top: 17px; font-size: 11px; color: #85898e; }
.profile-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; padding-bottom: 18px; }
.profile-toolbar > div { margin-inline-end: auto; display: grid; gap: 3px; font-size: 11px; }
.profile-toolbar b { font-size: 16px; color: #9c792c; }
#save-status { color: #85898e; }
.profile-fields, .project-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; background: #fff; padding: 22px; border: 1px solid #e1e4e7; border-radius: 10px; }
.clients-page label { font-size: 12px; color: #66696d; display: block; }
.clients-page label input, .clients-page label select { margin-top: 7px; }
.profile-fields .client-field-wide { grid-column: span 2; }
.clients-page label textarea { margin-top: 7px; width: 100%; resize: vertical; min-height: 78px; padding: 10px 12px; border: 1px solid #dddfe2; border-radius: 6px; font: inherit; color: #454649; background: #fff; }
.clients-page textarea:focus-visible { outline: 3px solid #f5b427; outline-offset: 2px; }
.project-bar { display: flex; align-items: end; gap: 12px; margin: 23px 0 14px; }
.project-bar label { flex: 1; max-width: 400px; }
.project-bar > span { margin-inline-start: auto; font-size: 11px; align-self: center; overflow-wrap: anywhere; }
.clients-tabs { display: flex; gap: 6px; padding: 22px 0 12px; overflow-x: auto; }
.clients-tabs button { flex: 1; min-width: 160px; border: 1px solid #e2e4e6; background: #fff; border-radius: 8px; padding: 14px 10px; color: #71767c; font-size: 13px; }
.clients-tabs button[aria-selected="true"] { background: #58595b; color: #fff; border-color: #58595b; box-shadow: inset 0 -3px #f5b427; }
.clients-tabs button:focus-visible, .clients-page a:focus-visible { outline: 3px solid #f5b427; outline-offset: 2px; }
.client-panel { background: #fff; border: 1px solid #e1e4e7; border-radius: 12px; padding: 25px; min-height: 300px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 17px; flex-wrap: wrap; }
.client-projects { margin-top: 23px; min-height: 180px; }
.client-project-list { list-style: none; margin: 0; padding: 0; }
.client-project-list li { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 15px; padding: 17px 0; border-top: 1px solid #eef0f2; }
.client-project-list li > div { min-width: 0; flex: 1; }
.client-project-list b { font-size: 12px; color: #9c792c; }
.client-project-list h3 { font-size: 16px; margin: 6px 0; overflow-wrap: anywhere; }
.client-project-list p { margin: 0; overflow-wrap: anywhere; }
.client-project-empty { padding: 10px 0; }
.clients-page a[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.panel-heading h2 { font-size: 21px; font-weight: 600; }
.panel-heading p { font-size: 11px; color: #8c9096; margin-top: 5px; }
.panel-links { display: flex; gap: 8px; flex-wrap: wrap; }
.clients-page a.button { text-decoration: none; }
.table-scroll { overflow-x: auto; width: 100%; border: 1px solid #e5e7e9; border-radius: 8px; }
.clients-table { width: 100%; border-collapse: collapse; text-align: start; font-size: 12px; }
.clients-table th { background: #f7f8f9; padding: 12px 10px; color: #777c82; font-weight: 500; text-align: start; white-space: nowrap; }
.clients-table td { padding: 9px 10px; border-top: 1px solid #eef0f2; vertical-align: middle; }
.clients-table input, .clients-table select { font-size: 12px; min-height: 38px; padding: 7px 8px; margin: 0; }
.clients-table .item-title { min-width: 230px; }
.clients-table .item-number { min-width: 94px; width: 110px; font-family: Manrope, monospace; }
.clients-table select { min-width: 112px; }
.clients-table td.line-total { white-space: nowrap; min-width: 115px; font-family: Manrope, monospace; }
.clients-table .scope-toggle { width: 18px; height: 18px; min-height: 0; accent-color: #bc8c27; }
.clients-table tr.disabled-item { background: #fafafa; color: #9ba0a6; }
.item-icon { display: inline-flex; align-items: center; gap: 7px; color: #aa8537; }
.item-icon .icon { width: 19px; height: 19px; }
.remove-item { color: #a44f47; border: 1px solid #eddbd8; background: #fff; border-radius: 5px; padding: 6px 9px; font-size: 11px; }
.pricing-bottom { display: flex; justify-content: space-between; gap: 25px; padding: 21px 0 30px; align-items: start; }
.vat-toggle { display: flex !important; align-items: center; gap: 9px; line-height: 1.8; }
.vat-toggle input { width: 18px; min-height: 18px; margin: 0 !important; accent-color: #c59329; }
.quote-totals { min-width: 310px; }
.quote-totals > div { display: flex; justify-content: space-between; gap: 20px; font-size: 13px; padding: 8px 0; }
.quote-totals > div:last-child { font-size: 18px; font-weight: 600; color: #8b681e; border-top: 1px solid #e6d2a7; margin-top: 7px; padding-top: 15px; }
.quote-totals output { white-space: nowrap; }
.contract-card { padding: 22px; border: 1px solid #e1e4e7; border-radius: 10px; margin-bottom: 14px; }
.contract-card .contract-top { display: flex; align-items: center; justify-content: space-between; gap: 15px; flex-wrap: wrap; margin-bottom: 15px; }
.contract-card h3 { font-size: 16px; }
.approval-grid-clients { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; margin-top: 15px; }
.approval-actor { background: #fafafa; border: 1px solid #e7e8e9; padding: 15px; border-radius: 8px; font-size: 12px; }
.approval-actor img { display: block; width: 135px; height: 65px; object-fit: contain; margin-top: 9px; }
.approval-actor time { display: block; font-size: 11px; color: #91959b; margin-top: 5px; }
.payment-summary { padding: 18px 0; border-top: 1px solid #e5e7e9; margin-top: 20px; }
.payment-summary h3, .receipts-block h3 { font-size: 16px; margin: 8px 0 13px; }
.visits-metrics { display: flex; flex-wrap: wrap; gap: 12px; margin: 15px 0; }
.visits-metrics > div { flex: 1; min-width: 150px; padding: 17px; border: 1px solid #e2e4e6; border-radius: 9px; background: #fafafa; }
.visits-metrics strong { display: block; font-size: 23px; color: #9b762d; }
.visits-metrics span { font-size: 11px; color: #8c9096; }
.receipts-block { border-top: 1px solid #e4e6e8; margin-top: 24px; padding-top: 20px; }
.receipt-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.receipt-actions .button { font-size: 10px; min-height: 31px; padding: 6px 9px; }
.clients-dialog { max-width: 680px; }
.clients-dialog p { font-size: 12px; line-height: 1.9; margin: 13px 0; color: #83888e; }
.clients-dialog .modal-header h2 { font-size: 22px; }
.portal-actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 15px; }
#portal-result { border-top: 1px solid #e2e4e6; margin-top: 20px; padding-top: 17px; }
#portal-url { font: 11px monospace; }
.review-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.review-columns pre { font: 11px 'IBM Plex Sans Arabic', monospace; white-space: pre-wrap; overflow-wrap: anywhere; background: #f8f9fa; padding: 12px; max-height: 330px; overflow: auto; }
.clients-footer { display: flex; justify-content: center; gap: 20px; flex-wrap: wrap; padding: 23px; border-top: 1px solid #e3e5e7; background: #fff; font-size: 11px; position: relative; isolation: isolate; }
.clients-footer::before { content: ''; position: absolute; inset: 0; z-index: -1; background: url('/assets/brand-pattern.png') center / 400px; opacity: .05; pointer-events: none; }
.clients-footer small { width: 100%; text-align: center; color: #868b91; }
.clients-page button:disabled { opacity: .55; cursor: not-allowed; }
@media (max-width: 1000px) {
  .client-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-fields, .project-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .clients-brand span { display: none; }
  .clients-header { gap: 13px; }
}
@media (max-width: 640px) {
  .clients-header { padding: 13px 16px; }
  .clients-header nav { order: 3; width: 100%; }
  .clients-header nav a { padding: 8px; font-size: 11px; }
  .clients-brand img { width: 120px; height: 44px; }
  .clients-auth { max-width: 165px; }
  .clients-workspace { padding: 23px 14px 40px; }
  .clients-heading { align-items: start; }
  .clients-heading > .button { font-size: 11px; padding: 9px; white-space: nowrap; }
  .client-cards { grid-template-columns: 1fr; }
  .profile-toolbar .button { flex: 1; font-size: 11px; }
  .profile-toolbar > div { order: -1; width: 100%; }
  .profile-fields, .project-fields { padding: 15px; gap: 12px; }
  .project-fields label:nth-child(2) { grid-column: 1 / -1; }
  .project-bar { flex-wrap: wrap; }
  .project-bar > span { width: 100%; }
  .client-panel { padding: 16px; }
  .pricing-bottom { flex-direction: column; }
  .quote-totals { width: 100%; min-width: 0; }
  .approval-grid-clients, .review-columns { grid-template-columns: 1fr; }
  .directory-tools { gap: 8px; flex-wrap: wrap; }
  .directory-tools .search-box { flex-basis: 100%; }
  .directory-tools .client-type-filter { flex: 1; min-width: 140px; }
  .directory-tools .button { font-size: 11px; padding: 8px; }
  .clients-auth .button, .receipt-actions .button, .remove-item { min-height: 44px; }
  .clients-header nav a { display: inline-flex; align-items: center; min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) { .client-card { transition: none; } }
@media print { .clients-page > * { display: none; } }
