/* Abfa agreement portal — RTL, responsive, dependency-free */
:root {
    --ink: #172d40;
    --muted: #65778a;
    --teal: #087e82;
    --teal-dark: #05686d;
    --teal-soft: #e7f5f3;
    --line: #dce5ed;
    --surface: #ffffff;
    --canvas: #f4f7f9;
    --danger: #b33543;
    --radius: 10px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    background: var(--canvas);
    color: var(--ink);
    font: 15px/1.85 Tahoma, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: var(--teal-dark); }
button, input, textarea { font: inherit; }
button, input[type="submit"] { cursor: pointer; }
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.masthead { background: #fff; border-bottom: 1px solid var(--line); }
.masthead-inner { max-width: 1060px; min-height: 82px; padding: 14px 24px; margin: auto; display: flex; justify-content: space-between; align-items: center; gap: 15px; }
.brand-link { display: flex; align-items: center; gap: 12px; color: inherit; }
.brand-mark { width: 44px; height: 44px; border-radius: 8px; background: var(--teal); color: white; font-weight: 700; font-size: 24px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; line-height: 1; }
.masthead-inner > .brand-mark { margin-left: 12px; }
.masthead-inner > .brand-text { margin-left: auto; }
.brand-text { display: flex; flex-direction: column; line-height: 1.55; gap: 4px; }
.brand-text strong { font-size: 14px; font-weight: 700; color: var(--ink); }
.brand-text span { font-size: 12px; color: var(--muted); }
.nav-link { font-size: 13px; color: var(--teal-dark); border: 1px solid var(--line); border-radius: 7px; padding: 7px 12px; white-space: nowrap; }
.nav-link:hover, .nav-link:focus { background: var(--teal-soft); }
.page { width: 100%; max-width: 1060px; padding: 54px 24px 58px; margin: 0 auto; flex: 1; }
.hero { max-width: 790px; margin: 0 auto 40px; text-align: center; }
.eyebrow { font-size: 13px; color: var(--teal); font-weight: 700; display: inline-flex; align-items: center; gap: 8px; margin-bottom: 15px; }
.eyebrow-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); display: inline-block; }
h1, h2, p { margin-top: 0; }
.hero h1 { font-size: clamp(23px, 3.3vw, 34px); font-weight: 800; line-height: 1.75; letter-spacing: -.7px; margin-bottom: 13px; }
.hero p { max-width: 640px; margin: 0 auto; color: var(--muted); font-size: 14px; line-height: 2; }
.steps { margin: 35px auto 0; display: flex; align-items: center; justify-content: center; gap: 13px; }
.step { display: flex; gap: 8px; align-items: center; font-size: 13px; color: #8896a5; white-space: nowrap; }
.step-number { display: inline-flex; align-items: center; justify-content: center; width: 27px; height: 27px; background: #e5ebef; border-radius: 50%; color: #718195; font-size: 12px; }
.step.active { color: var(--teal-dark); font-weight: 700; }
.step.active .step-number { color: #fff; background: var(--teal); }
.step-line { height: 1px; width: 55px; background: var(--line); }
.surface { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 33px 40px 26px; }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; border-bottom: 1px solid var(--line); padding-bottom: 20px; margin-bottom: 30px; }
.section-kicker { font-size: 12px; color: var(--teal); font-weight: 700; }
.section-head h2 { margin: 5px 0 0; font-weight: 750; font-size: 20px; }
.required-hint { color: var(--muted); font-size: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; row-gap: 25px; }
.field { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.field.full { grid-column: 1/-1; }
.field label { font-size: 13px; font-weight: 700; }
.required { color: var(--danger); }
.input { width: 100%; height: 46px; padding: 9px 13px; outline: none; border: 1px solid #cbd8e1; border-radius: 7px; background: #fff; color: var(--ink); transition: border-color .15s; }
.input:hover { border-color: #91a8b7; }
.input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(8,126,130,.11); }
.input::placeholder { color: #8a9aa7; }
.ltr-input { direction: ltr; text-align: right; font-family: Tahoma, "Segoe UI", sans-serif; }
.text-area { resize: vertical; height: auto; min-height: 102px; }
.field-help { font-size: 11px; color: var(--muted); line-height: 1.7; }
.form-footer { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 34px; padding-top: 24px; border-top: 1px solid var(--line); }
.footer-note { font-size: 12px; color: var(--muted); line-height: 1.9; max-width: 590px; }
.btn { display: inline-flex; justify-content: center; align-items: center; min-height: 46px; border: 1px solid transparent; border-radius: 7px; font-size: 13px; font-weight: 700; white-space: normal; text-align: center; padding: 10px 23px; }
.btn-primary { background: var(--teal); color: white; min-width: 156px; }
.btn-primary:hover { background: var(--teal-dark); }
.btn-outline { background: #fff; border-color: var(--teal); color: var(--teal-dark); }
.btn-outline:hover { background: var(--teal-soft); }
.privacy-note { text-align: center; font-size: 12px; color: var(--muted); margin-top: 22px; }
.footer { border-top: 1px solid var(--line); text-align: center; color: var(--muted); font-size: 12px; padding: 23px 16px; }
.footer span { padding: 0 4px; }
.alert { padding: 13px 17px; margin: 20px 0; border: 1px solid transparent; border-radius: 7px; font-size: 13px; line-height: 2; }
.alert-error { background: #fdf1f2; color: #8d2735; border-color: #f0d0d5; }
.alert-info { background: #f0f6fb; border-color: #d5e5f1; color: #325b78; }
.alert-success { background: #edf8f3; border-color: #caeadb; color: #166244; }
.page-narrow { max-width: 790px; }
.small-hero { margin-bottom: 25px; }
.small-hero h1 { font-size: 27px; margin: 3px 0 6px; }
.small-hero p { color: var(--muted); margin: 0; }
.tracking-form { display: flex; gap: 15px; align-items: flex-end; }
.tracking-form .field { flex: 1; }
.tracking-form .btn { height: 46px; }
.separator { height: 1px; border: 0; background: var(--line); margin: 30px 0; }
.status-card { border: 1px solid var(--line); border-radius: 8px; padding: 23px; }
.status-card-header { display: flex; align-items: center; justify-content: space-between; font-size: 14px; font-weight: 700; }
.status-pill { color: #9b691b; background: #fff5e0; font-size: 12px; padding: 4px 10px; border-radius: 20px; font-weight: 700; }
.tracking-number { display: flex; align-items: center; justify-content: space-between; margin: 20px 0; padding: 15px 18px; border: 1px dashed #9dbaae; border-radius: 7px; background: #f7faf9; gap: 10px; }
.tracking-number span { color: var(--muted); font-size: 13px; }
.tracking-number strong { direction: ltr; unicode-bidi: isolate; font-size: 19px; overflow-wrap: anywhere; }
.timeline { padding: 0 4px; margin-bottom: 24px; }
.timeline-row { display: flex; align-items: stretch; gap: 15px; color: #738394; }
.timeline-row:not(:last-child) .timeline-dot:after { content: ''; position: absolute; top: 18px; right: 6px; height: calc(100% + 16px); width: 1px; background: #d5dfe6; }
.timeline-row > div { padding-bottom: 21px; }
.timeline-row strong, .timeline-row small { display: block; }
.timeline-row strong { font-size: 13px; color: var(--ink); }
.timeline-row small { font-size: 12px; }
.timeline-dot { position: relative; margin-top: 7px; width: 13px; height: 13px; border: 2px solid #bac9d1; border-radius: 50%; background: #fff; flex-shrink: 0; }
.timeline-row.complete .timeline-dot { border-color: var(--teal); background: var(--teal); }
.timeline-row.complete .timeline-dot:after { background: var(--teal); }
a:focus-visible, .btn:focus-visible { outline: 3px solid #9acfd0; outline-offset: 2px; }
@media (max-width: 650px) {
    .masthead-inner { padding: 12px 16px; min-height: 76px; }
    .brand-text strong { font-size: 11px; }
    .brand-text span { font-size: 10px; }
    .brand-mark { width: 37px; height: 37px; font-size: 20px; }
    .nav-link { font-size: 11px; padding: 5px 7px; }
    .page { padding: 33px 13px 44px; }
    .hero { margin-bottom: 27px; }
    .hero h1 { font-size: 22px; line-height: 1.9; }
    .steps { gap: 5px; margin-top: 22px; }
    .step { flex-direction: column; font-size: 10px; gap: 3px; }
    .step-line { width: 26px; }
    .surface { padding: 22px 16px; }
    .section-head { align-items: flex-start; flex-direction: column; gap: 5px; margin-bottom: 22px; }
    .form-grid { grid-template-columns: 1fr; row-gap: 18px; }
    .field.full { grid-column: auto; }
    .form-footer { align-items: stretch; flex-direction: column; gap: 16px; }
    .form-footer .btn { width: 100%; }
    .tracking-form { flex-direction: column; align-items: stretch; }
    .tracking-form .btn { width: 100%; }
    .small-hero h1 { font-size: 23px; }
    .status-card { padding: 16px; }
}

/* Searchable case list and restricted case editor */
.cases-section { margin-top: 30px; }
.cases-hint { margin: -10px 0 25px; color: var(--muted); font-size: 13px; line-height: 2; }
.case-filters { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 15px; margin-bottom: 24px; }
.case-filters .field label { font-size: 12px; }
.case-filters .input { height: 42px; }
.filter-actions { display: flex; align-items: flex-end; gap: 8px; }
.filter-actions .btn { min-height: 42px; flex: 1; min-width: 0; padding: 8px 11px; }
.case-table-wrap { overflow-x: auto; width: 100%; border: 1px solid var(--line); border-radius: 8px; }
.case-table { border-collapse: collapse; min-width: 750px; width: 100%; font-size: 13px; }
.case-table th { background: #f2f7f8; color: #3c566b; font-weight: 700; text-align: right; padding: 13px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.case-table td { padding: 14px 12px; border-bottom: 1px solid #eaf0f3; vertical-align: middle; }
.case-table tbody tr:last-child td { border-bottom: 0; }
.case-table tbody tr:hover { background: #fafdfd; }
.case-reference { direction: ltr; text-align: right; unicode-bidi: isolate; font-weight: 700; }
.case-number { direction: ltr; text-align: right; unicode-bidi: isolate; white-space: nowrap; color: var(--muted); }
.payment-badge { display: inline-block; border-radius: 6px; padding: 3px 10px; white-space: nowrap; font-size: 12px; font-weight: 700; }
.payment-paid { background: #e6f6ec; color: #187340; }
.payment-unpaid { background: #fdecef; color: #b12a42; }
.payment-pending { background: #fff4db; color: #926315; }
.table-action { display: inline-block; padding: 5px 13px; border-radius: 5px; border: 1px solid #b3d4d3; color: var(--teal-dark); font-size: 12px; font-weight: 700; }
.table-action:hover { background: var(--teal-soft); }
.table-action-muted { color: #82909a; font-size: 12px; white-space: nowrap; }
.cases-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; font-size: 12px; color: var(--muted); gap: 12px; }
.pager { display: flex; gap: 8px; }
.pager .btn { min-height: 36px; padding: 6px 12px; font-size: 12px; }
.pager .btn:disabled { opacity: .42; cursor: not-allowed; }
.cases-empty { text-align: center; padding: 35px 10px; font-size: 13px; color: var(--muted); }
@media (max-width: 740px) {
    .case-filters { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .filter-actions { align-items: end; }
}
@media (max-width: 490px) {
    .case-filters { grid-template-columns: 1fr; gap: 13px; }
    .filter-actions .btn { flex: 1; }
    .cases-footer { flex-direction: column; align-items: stretch; }
    .pager .btn { flex: 1; }
}

/* Inline case filtering and edit workflow */
#registration, #cases { scroll-margin-top: 18px; }
.case-table { min-width: 940px; }
.case-table .column-filters th {
    padding: 9px 7px;
    background: #fff;
    vertical-align: middle;
    border-bottom: 1px solid var(--line);
}
.case-table .table-filter {
    display: block;
    width: 100%;
    height: 38px;
    min-width: 0;
    font-size: 12px;
    padding: 7px 9px;
    border-radius: 6px;
    font-weight: 400;
}
.case-table .table-filter-actions { white-space: nowrap; text-align: center; }
.case-table .table-filter-actions .btn {
    min-width: 0;
    min-height: 36px;
    padding: 5px 9px;
    margin: 2px;
    font-size: 11px;
}
.form-actions { display: flex; gap: 9px; flex-wrap: wrap; }
.inline-verification {
    padding: 19px 21px;
    margin: 0 0 26px;
    border: 1px solid #cddfe4;
    border-radius: 8px;
    background: #f6fafb;
}
.inline-verification h3 { margin: 0 0 5px; font-size: 16px; }
.inline-verification p { margin: 0 0 16px; font-size: 12px; color: var(--muted); }
.inline-verify-fields {
    display: grid;
    grid-template-columns: minmax(0,1fr) minmax(0,1fr);
    gap: 14px;
    align-items: end;
}
.inline-verify-actions {
    grid-column: 1/-1;
    display: flex;
    gap: 9px;
}
.inline-verify-actions .btn { min-width: 120px; }
@media (max-width: 650px) {
    .inline-verify-fields { grid-template-columns: 1fr; }
    .inline-verify-actions { flex-wrap: wrap; }
    .inline-verify-actions .btn { flex: 1; }
    .form-actions { flex-direction: column; }
    .form-actions .btn { width: 100%; }
    .inline-verification { padding: 16px; }
}

/* Refined single-row search grid */
#cases.cases-section {
    padding: 27px 26px 22px;
}
#cases .section-head { padding-bottom: 15px; margin-bottom: 20px; }
#cases .section-head h2 { font-size: 18px; }
#cases .cases-hint { margin: -4px 0 17px; font-size: 12px; }
#cases .case-table-wrap { border-color: #e3eaf0; border-radius: 7px; }
#cases .case-table { min-width: 825px; width: 100%; font-size: 12.5px; }
#cases .case-table thead th {
    padding: 12px 9px 10px;
    background: #f7f9fb;
    color: #425b6d;
    border-bottom: 1px solid #dfe7eb;
    font-weight: 700;
    vertical-align: top;
}
#cases .case-th-label {
    display: block;
    padding: 0 1px 7px;
    line-height: 1.5;
    font-size: 12px;
    letter-spacing: 0;
}
#cases .case-th-actions { width: 104px; text-align: center; }
#cases .case-th-hint {
    display: block;
    font-size: 10px;
    font-weight: 400;
    color: #9aa7b1;
    padding-top: 9px;
}
#cases .case-table .table-filter {
    display: block;
    height: 31px;
    padding: 4px 8px;
    font-size: 11px;
    line-height: 1.5;
    width: 100%;
    font-weight: 400;
    color: var(--ink);
    background: #fff;
    border-radius: 5px;
    border: 1px solid #d8e1e7;
    box-shadow: none;
}
#cases .case-table .table-filter::placeholder { color: #a0adb9; opacity: 1; }
#cases .case-table .table-filter:focus {
    border-color: var(--teal);
    outline: 2px solid #d8f0ef;
    outline-offset: 0;
    box-shadow: none;
}
#cases .case-table tbody td {
    padding: 11px 10px;
    height: 51px;
    border-bottom: 1px solid #ebf0f3;
}
#cases .case-table tbody tr:nth-child(even) { background: #fbfcfd; }
#cases .case-table tbody tr:hover { background: #f5f9f9; }
#cases .payment-badge {
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 600;
}
#cases .table-action {
    border: 1px solid #b8d8d7;
    padding: 3px 11px;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
#cases .case-search-status { font-size: 11px; color: #697d8e; min-height: 0; }
#cases .case-search-status:not(:empty) { margin-top: 7px; }
#cases .case-search-status.search-loading { color: var(--teal); }
#cases .cases-footer { margin-top: 13px; }
#cases .pager .btn { min-height: 32px; font-size: 11px; border-color: #d6e1e8; color: #446b73; }
#cases .pager .btn:disabled { background: #f8fafb; }
@media (max-width: 650px) {
    #cases.cases-section { padding: 20px 12px; }
    #cases .case-table { min-width: 780px; }
}

/* ABFA tariff quote, SMS preview and electronic payment step */
.payment-surface { padding: 28px 34px 30px; }
.payment-identity {
    display: flex; align-items: center; justify-content: space-between;
    gap: 15px; padding-bottom: 19px; margin-bottom: 17px;
    border-bottom: 1px solid var(--line);
}
.payment-identity > div { display: flex; flex-direction: column; gap: 3px; }
.payment-label { font-size: 12px; color: var(--muted); }
.payment-label strong { color: var(--ink); }
.payment-code { font-size: 18px; direction: ltr; text-align: right; unicode-bidi: isolate; }
.payment-quote { border: 1px solid #dfe9e9; border-radius: 8px; overflow: hidden; }
.payment-quote-row {
    display: flex; align-items: center; justify-content: space-between; gap: 15px;
    padding: 13px 17px; background: #fff; font-size: 13px;
    border-bottom: 1px solid #ebeff3;
}
.payment-quote-row:last-child { border-bottom: none; }
.payment-quote-row > span { color: #607789; }
.payment-quote-row strong { font-size: 15px; direction: ltr; unicode-bidi: isolate; }
.payment-quote-row strong small { font-size: 11px; font-weight: 500; }
.payment-total { background: #eaf5f4; padding-top: 17px; padding-bottom: 17px; }
.payment-total span { color: #125c62; font-weight: 700; }
.payment-total strong { color: #086c70; font-size: 22px; }
.payment-link-section { padding: 21px 0; border-bottom: 1px solid var(--line); }
.payment-link-section p { color: var(--muted); font-size: 12px; margin: 5px 0 15px; }
.payment-link-section .btn { min-width: 135px; min-height: 42px; }
.payment-action-row {
    display: flex; align-items: center; justify-content: space-between;
    gap: 18px; padding: 23px 0 11px;
}
.payment-action-note { color: var(--muted); max-width: 350px; font-size: 11px; }
.payment-back { margin-top: 20px; display: flex; justify-content: flex-start; }
.sms-modal-backdrop {
    position: fixed; z-index: 1100; inset: 0; padding: 20px;
    display: flex; justify-content: center; align-items: center;
    background: rgba(19,38,51,.54);
}
.sms-modal {
    width: 100%; max-width: 525px; max-height: calc(100vh - 45px);
    overflow-y: auto; background: #fff; border: 1px solid #d5e1e6;
    border-radius: 10px; padding: 23px; color: var(--ink);
}
.sms-modal-header { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.sms-modal-header h2 { margin: 3px 0 0; font-size: 20px; }
.sms-close {
    border: 1px solid var(--line); background: #fff; font-size: 25px;
    line-height: 1; width: 32px; height: 32px; border-radius: 6px;
    display: inline-flex; align-items: center; justify-content: center; color: var(--muted);
}
.sms-modal-note { margin: 13px 0 13px; font-size: 12px; color: var(--muted); }
.sms-phone-line { font-size: 12px; color: var(--muted); margin-bottom: 11px; }
.sms-phone-line strong { color: var(--ink); direction: ltr; unicode-bidi: isolate; }
.sms-preview-text {
    margin: 0; padding: 19px 20px; background: #f5f8fa; color: #263c49;
    border: 1px solid #e0e9ee; border-radius: 7px;
    white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word;
    direction: rtl; font: 13px/2.3 Tahoma, "Segoe UI", sans-serif;
}
.sms-modal-actions { display: flex; justify-content: flex-end; margin-top: 18px; }
@media(max-width: 650px) {
    .payment-surface { padding: 20px 17px; }
    .payment-action-row { flex-direction: column; align-items: stretch; }
    .payment-action-row .btn { width: 100%; }
    .sms-modal { padding: 17px; }
    .payment-total strong { font-size: 19px; }
}

/* Payment-result supervisor profile */
.demo-mode-notice { background: #fff8e9; border-color: #f1d9a7; color: #815b18; }
.assigned-panel { margin-top: 24px; border: 1px solid #d9e7e4; border-radius: 8px; overflow: hidden; background: #fff; }
.assigned-head { display: flex; align-items: center; gap: 13px; background: #eff8f5; padding: 16px 19px; border-bottom: 1px solid #deede7; }
.assigned-head h2 { margin: 1px 0 1px; font-size: 18px; }
.assigned-head p { margin: 0; color: #688078; font-size: 12px; }
.assigned-check { display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%; color: #fff; font-weight: 700; background: #21845e; }
.assigned-engineer { padding: 21px; display: flex; gap: 18px; align-items: center; }
.engineer-photo-wrap { width: 98px; height: 112px; flex: 0 0 98px; border: 1px solid #e0e8ec; border-radius: 7px; overflow: hidden; background: #f0f4f6; }
.engineer-photo { width: 100%; height: 100%; object-fit: cover; display: block; }
.engineer-info { min-width: 0; flex: 1; }
.engineer-name { font-size: 17px; margin-bottom: 10px; display: block; }
.engineer-detail { display: flex; justify-content: space-between; gap: 20px; max-width: 390px; font-size: 13px; padding: 3px 0; }
.engineer-detail > span { color: var(--muted); }
.engineer-detail strong { font-weight: 600; }
.ltr-value { direction: ltr; unicode-bidi: isolate; }
.assigned-receipt { padding: 13px 21px; background: #fbfdfd; border-top: 1px solid #edf1f3; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 13px 23px; }
.assigned-receipt > div { display: flex; flex-direction: column; font-size: 12px; }
.assigned-receipt span { color: var(--muted); }
.assigned-receipt strong { color: #2d4753; font-size: 13px; font-weight: 650; direction: ltr; unicode-bidi: isolate; }
.demo-receipt-disclaimer { margin: 0; border-top: 1px solid #f0e6c8; background: #fff9ec; padding: 10px 20px; color: #8b6722; font-size: 12px; }
@media (max-width: 490px) {
  .assigned-engineer { align-items: flex-start; padding: 15px; gap: 12px; }
  .engineer-photo-wrap { width: 74px; height: 88px; flex-basis: 74px; }
  .engineer-name { font-size: 14px; }
  .engineer-detail { flex-direction: column; gap: 0; padding: 2px 0; font-size: 12px; }
  .assigned-receipt { padding: 12px 15px; gap: 10px; }
}

/* Unified progress indicators and compact supervisor payment receipt */
.status-pill.status-pill-success {
    color: #167548;
    background: #e7f6ed;
    border: 1px solid #cdebd7;
}
.status-pill.status-pill-pending {
    color: #94651e;
    background: #fff4dc;
    border: 1px solid #f3e2b8;
}
.status-pill.status-pill-waiting {
    color: #926314;
    background: #fff4df;
    border: 1px solid #f0dfba;
}
.timeline { margin: 20px 0 18px; }
.timeline-row { gap: 14px; }
.timeline-row > div { padding-bottom: 25px; }
.timeline-row:last-child > div { padding-bottom: 2px; }
.timeline-row .timeline-dot {
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    margin-top: 2px;
    border-radius: 50%;
    border: 2px solid #c9d6df;
    background: #fff;
    position: relative;
}
.timeline-row .timeline-dot::after { display: none; }
.timeline-row:not(:last-child) .timeline-dot::after {
    display: block;
    content: "";
    position: absolute;
    top: 21px;
    right: 8px;
    height: calc(100% + 26px);
    width: 2px;
    background: #e4eaef;
}
.timeline-row.complete .timeline-dot {
    border: 2px solid #138468;
    background: #138468;
}
.timeline-row.complete .timeline-dot::before {
    content: "✓";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    font: bold 15px/1 Tahoma, sans-serif;
    color: #fff;
}
.timeline-row.complete:not(:last-child) .timeline-dot::after { background: #45a68e; }
.timeline-row.current .timeline-dot {
    border: 2px solid #0b8287;
    background: #fff;
    box-shadow: 0 0 0 4px #e4f5f3;
}
.timeline-row.current .timeline-dot::before {
    content: "";
    position: absolute;
    inset: 5px;
    border-radius: 50%;
    background: #0b8287;
}
.timeline-row.complete strong { color: #176c58; }
.timeline-row.current strong { color: #08686d; }
.tracking-assigned { margin-top: 22px; }
.assigned-receipt {
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 11px;
    padding: 17px 19px;
    background: #f9fbfc;
    border-top: 1px solid #e7edf1;
}
.assigned-receipt .receipt-item {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 5px;
    min-width: 0;
    border: 1px solid #e6edf0;
    background: #fff;
    border-radius: 7px;
    padding: 11px 14px;
}
.assigned-receipt .receipt-item > span {
    color: #6b7e8f;
    font-size: 11px;
    line-height: 1.7;
}
.assigned-receipt .receipt-item > strong {
    color: #233d4c;
    font-size: 14px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.15px;
    line-height: 1.65;
    direction: ltr;
    unicode-bidi: isolate;
    text-align: right;
    white-space: nowrap;
    max-width: 100%;
}
.assigned-receipt .receipt-item .receipt-money {
    color: #096e63;
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 17px;
}
.assigned-receipt .receipt-money span { color: #58707b; font-size: 11px; font-weight: 500; }
.engineer-phone-link {
    display: inline-flex;
    direction: ltr;
    unicode-bidi: isolate;
    align-items: center;
    font-variant-numeric: tabular-nums;
    border-radius: 5px;
    padding: 2px 5px;
    font-size: 13px;
    font-weight: 700;
    color: var(--teal-dark);
    border-bottom: 1px dashed #69a6a5;
    text-decoration: none;
}
.engineer-phone-link:hover,
.engineer-phone-link:focus-visible { color: #07525a; background: #e9f6f5; }
.engineer-phone-link.phone-unavailable { pointer-events: none; border-bottom: none; color: var(--ink); }
@media (max-width: 470px) {
    .assigned-receipt { grid-template-columns: 1fr; padding: 12px; gap: 8px; }
    .assigned-receipt .receipt-item { padding: 9px 12px; }
    .status-card-header { flex-wrap: wrap; gap: 9px; }
}

/* Global display-mode switch (all portal pages) */
.header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
    margin-inline-start: auto;
}
.theme-toggle {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 36px;
    padding: 7px 13px;
    border: 1px solid var(--line);
    border-radius: 7px;
    font: 600 12px/1.5 Tahoma, "Segoe UI", sans-serif;
    background: var(--surface);
    color: var(--ink);
    white-space: nowrap;
    cursor: pointer;
}
.theme-toggle:hover { border-color: var(--teal); background: var(--teal-soft); }
.theme-toggle:focus-visible { outline: 3px solid #71bdc2; outline-offset: 2px; }
.theme-toggle-symbol { font-size: 18px; line-height: 1; color: var(--teal); }
.engineer-detail.engineer-mobile-row {
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    max-width: none;
}
.engineer-detail.engineer-mobile-row > span { white-space: nowrap; }
.engineer-detail.engineer-mobile-row .engineer-phone-link { padding-inline: 2px 5px; }
@media (max-width: 650px) {
    .masthead-inner { gap: 10px; }
    .header-actions { gap: 6px; }
    .theme-toggle { font-size: 11px; padding: 5px 8px; min-height: 34px; gap: 5px; }
    .theme-toggle-symbol { font-size: 15px; }
}
@media (max-width: 420px) {
    .masthead-inner { flex-wrap: wrap; }
    .header-actions { width: 100%; justify-content: flex-end; }
}

html[data-theme="dark"] {
    color-scheme: dark;
    --ink: #edf4f8;
    --muted: #a8b9c7;
    --teal: #29b5b2;
    --teal-dark: #60d2cd;
    --teal-soft: #173b42;
    --line: #334b59;
    --surface: #1b2d39;
    --canvas: #0d1a25;
    --danger: #ff8e9c;
}
html[data-theme="dark"] body { background: var(--canvas); color: var(--ink); }
html[data-theme="dark"] .masthead,
html[data-theme="dark"] .surface,
html[data-theme="dark"] .sms-modal,
html[data-theme="dark"] .assigned-panel {
    background: var(--surface);
    border-color: var(--line);
    color: var(--ink);
}
html[data-theme="dark"] .brand-text strong,
html[data-theme="dark"] .section-head h2,
html[data-theme="dark"] .small-hero h1,
html[data-theme="dark"] .hero h1,
html[data-theme="dark"] .engineer-name,
html[data-theme="dark"] .engineer-detail strong,
html[data-theme="dark"] .tracking-number strong,
html[data-theme="dark"] .payment-code,
html[data-theme="dark"] .field label { color: var(--ink); }
html[data-theme="dark"] .nav-link,
html[data-theme="dark"] .btn-outline,
html[data-theme="dark"] .theme-toggle {
    background: #203642;
    border-color: var(--line);
    color: #83e1da;
}
html[data-theme="dark"] .nav-link:hover,
html[data-theme="dark"] .btn-outline:hover,
html[data-theme="dark"] .theme-toggle:hover {
    background: #245057;
    border-color: #419893;
    color: #e6fffb;
}
html[data-theme="dark"] .theme-toggle-symbol { color: #f9cf71; }
html[data-theme="dark"] .btn-primary,
html[data-theme="dark"] .brand-mark,
html[data-theme="dark"] .step.active .step-number {
    background: #198a89;
    color: #fff;
}
html[data-theme="dark"] .btn-primary:hover { background: #106f74; }
html[data-theme="dark"] .input,
html[data-theme="dark"] #cases .case-table .table-filter {
    background: #122531;
    color: var(--ink);
    border-color: #48606e;
}
html[data-theme="dark"] .input:focus,
html[data-theme="dark"] #cases .case-table .table-filter:focus {
    border-color: #51c4bc;
    outline-color: #366a70;
    box-shadow: 0 0 0 3px rgba(47,193,188,.16);
}
html[data-theme="dark"] .input::placeholder,
html[data-theme="dark"] #cases .case-table .table-filter::placeholder {
    color: #889eac;
}
html[data-theme="dark"] .step-number { background: #2b424e; color: #b9c8d0; }
html[data-theme="dark"] .step-line,
html[data-theme="dark"] .separator { background: var(--line); }
html[data-theme="dark"] .step.active { color: #78ded6; }
html[data-theme="dark"] .alert-info { background: #1b3449; color: #b0defd; border-color: #395a76; }
html[data-theme="dark"] .alert-success { background: #153b32; color: #a8ebc9; border-color: #37644f; }
html[data-theme="dark"] .alert-error { background: #472831; color: #ffc4cc; border-color: #784553; }
html[data-theme="dark"] .status-card,
html[data-theme="dark"] .tracking-number,
html[data-theme="dark"] .payment-quote,
html[data-theme="dark"] .case-table-wrap,
html[data-theme="dark"] #cases .case-table-wrap {
    border-color: var(--line);
}
html[data-theme="dark"] .tracking-number { background: #203840; border-color: #4a7776; }
html[data-theme="dark"] .status-pill,
html[data-theme="dark"] .status-pill.status-pill-pending,
html[data-theme="dark"] .status-pill.status-pill-waiting,
html[data-theme="dark"] .payment-pending { background: #46391e; color: #f9d38a; border-color: #74603a; }
html[data-theme="dark"] .status-pill.status-pill-success,
html[data-theme="dark"] .payment-paid { background: #154a38; color: #9feac7; border-color: #35745c; }
html[data-theme="dark"] .payment-unpaid { background: #512830; color: #ffb2c0; border-color: #854452; }
html[data-theme="dark"] .timeline-row strong { color: var(--ink); }
html[data-theme="dark"] .timeline-row { color: #9bb3c0; }
html[data-theme="dark"] .timeline-row.complete strong { color: #8ce4c7; }
html[data-theme="dark"] .timeline-row.current strong { color: #a8f0e6; }
html[data-theme="dark"] .timeline-row .timeline-dot { background: #1a2d3a; border-color: #647c89; }
html[data-theme="dark"] .timeline-row.complete .timeline-dot { background: #168971; border-color: #168971; }
html[data-theme="dark"] .timeline-row.complete:not(:last-child) .timeline-dot::after { background: #348d76; }
html[data-theme="dark"] .timeline-row:not(:last-child) .timeline-dot::after { background: #405764; }
html[data-theme="dark"] .timeline-row.current .timeline-dot { border-color: #60cbc0; box-shadow: 0 0 0 4px #1b4948; }
html[data-theme="dark"] .timeline-row.current .timeline-dot::before { background: #5ccec4; }
html[data-theme="dark"] .case-table th,
html[data-theme="dark"] #cases .case-table thead th { background: #243b49; color: #d6e5ed; border-color: var(--line); }
html[data-theme="dark"] #cases .case-table tbody tr:nth-child(even) { background: #1b303b; }
html[data-theme="dark"] #cases .case-table tbody tr:hover,
html[data-theme="dark"] .case-table tbody tr:hover { background: #294450; }
html[data-theme="dark"] .case-table td,
html[data-theme="dark"] #cases .case-table tbody td { border-color: #344b58; }
html[data-theme="dark"] .case-table .column-filters th { background: #203642; }
html[data-theme="dark"] #cases .pager .btn:disabled { background: #1e303a; color: #7f97a5; }
html[data-theme="dark"] .case-number,
html[data-theme="dark"] .case-th-hint,
html[data-theme="dark"] .table-action-muted { color: #a6b9c6; }
html[data-theme="dark"] .table-action { border-color: #497d80; color: #88e1dc; }
html[data-theme="dark"] .table-action:hover { background: #214e52; }
html[data-theme="dark"] .payment-quote-row,
html[data-theme="dark"] .assigned-receipt .receipt-item {
    background: #203541;
    border-color: #354d5b;
}
html[data-theme="dark"] .payment-total { background: #174743; border-color: #386a65; }
html[data-theme="dark"] .payment-total span,
html[data-theme="dark"] .payment-total strong { color: #9df0d8; }
html[data-theme="dark"] .payment-quote-row > span,
html[data-theme="dark"] .payment-label { color: #a5bcc9; }
html[data-theme="dark"] .payment-quote-row strong { color: var(--ink); }
html[data-theme="dark"] .payment-total strong { color: #aff9df; }
html[data-theme="dark"] .sms-modal { background: #1e3340; border-color: #4d6875; }
html[data-theme="dark"] .sms-close { background: #263f4d; color: var(--ink); border-color: #506975; }
html[data-theme="dark"] .sms-preview-text { background: #142b38; color: #edf7f8; border-color: #405a6a; }
html[data-theme="dark"] .sms-modal-note,
html[data-theme="dark"] .sms-phone-line { color: #aebfcd; }
html[data-theme="dark"] .sms-phone-line strong { color: var(--ink); }
html[data-theme="dark"] .demo-mode-notice,
html[data-theme="dark"] .demo-receipt-disclaimer {
    background: #473b23;
    color: #f9d9a0;
    border-color: #78633a;
}
html[data-theme="dark"] .assigned-head { background: #184438; border-color: #386757; }
html[data-theme="dark"] .assigned-head p { color: #b4d0c3; }
html[data-theme="dark"] .assigned-receipt { background: #182d39; border-color: #354e5b; }
html[data-theme="dark"] .assigned-receipt .receipt-item > span { color: #afc3cf; }
html[data-theme="dark"] .assigned-receipt .receipt-item > strong { color: #ecf6fb; }
html[data-theme="dark"] .assigned-receipt .receipt-item .receipt-money { color: #9ceccf; }
html[data-theme="dark"] .assigned-receipt .receipt-money span { color: #c2d1d7; }
html[data-theme="dark"] .engineer-phone-link { color: #93e9df; border-color: #4d9f9a; }
html[data-theme="dark"] .engineer-phone-link:hover,
html[data-theme="dark"] .engineer-phone-link:focus-visible { background: #214f50; color: #ebfffc; }
html[data-theme="dark"] .engineer-phone-link.phone-unavailable { color: #cddbe1; }
html[data-theme="dark"] .engineer-photo-wrap { background: #1b303b; border-color: #4b646e; }
html[data-theme="dark"] .inline-verification { background: #1e3443; border-color: #496474; }
html[data-theme="dark"] .assigned-check { color: white; }
@media (prefers-reduced-motion: no-preference) {
    body, .masthead, .surface, .input, .case-table th, .case-table td, .payment-quote-row, .sms-modal {
        transition: background-color .16s ease, color .16s ease, border-color .16s ease;
    }
}

/* Locally self-hosted Vazirmatn (SIL Open Font License 1.1).
   This applies uniformly to the registration, tracking, payment and editing screens. */
@font-face {
    font-family: "VazirmatnLocal";
    src: url("fonts/Vazirmatn-Variable.woff2") format("woff2");
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
}
html, body, input, textarea, select, button, .btn, .theme-toggle, .sms-preview-text {
    font-family: "VazirmatnLocal", Tahoma, "Segoe UI", sans-serif !important;
}
body { line-height: 1.82; }
.case-owner { min-width: 154px; line-height: 1.8; font-weight: 600; }
.case-count { text-align: center; font-variant-numeric: tabular-nums; white-space: nowrap; }
.case-engineer { min-width: 145px; line-height: 1.85; font-weight: 600; }
.case-engineer:empty::after { content: "—"; font-weight: 400; color: #95a5b0; }
#cases .case-table { min-width: 1110px; }
#cases .case-table th:nth-child(1) { min-width: 118px; }
#cases .case-table th:nth-child(2) { min-width: 180px; }
#cases .case-table th:nth-child(3) { min-width: 145px; }
#cases .case-table th:nth-child(4) { min-width: 105px; }
#cases .case-table th:nth-child(5) { min-width: 125px; }
#cases .case-table th:nth-child(6) { min-width: 175px; }
#cases .case-table th:nth-child(7) { min-width: 96px; }
#cases .case-table th:nth-child(8) { min-width: 135px; }
#cases .case-table .table-filter { font-size: 11px; line-height: 1.4; }
#cases .case-table .case-th-label { min-height: 43px; display: flex; align-items: center; }
#cases .case-table .case-th-hint { padding-top: 4px; }
.table-action.table-action-detail {
    white-space: nowrap;
    border-color: #93cbc1;
    color: #0a776c;
    background: #f2faf7;
}
.table-action.table-action-detail:hover { background: #dff2ec; }
html[data-theme="dark"] .table-action.table-action-detail {
    color: #adf1df;
    background: #224a47;
    border-color: #417f73;
}
.field-validation { display: block; min-height: 0; font-size: 12px; line-height: 1.8; }
.field-validation:empty { display: none; }
.field-validation.field-invalid { color: #ba3044; }
.field-validation.field-valid { color: #16754c; }
.input[aria-invalid="true"] { border-color: #c54356; box-shadow: 0 0 0 2px rgba(197,67,86,.1); }
html[data-theme="dark"] .field-validation.field-invalid { color: #ff9ba8; }
html[data-theme="dark"] .field-validation.field-valid { color: #86e9b1; }
html[data-theme="dark"] .case-engineer:empty::after { color: #9cacb9; }

/* 1.10: fit all eight case-list columns on desktop without lateral scrolling.
   On narrow screens, use a card grid and keep all six filters visible. */
.page:not(.page-narrow) { max-width: 1280px; padding-inline: 18px; }
#cases.cases-section { padding: 24px 20px 20px; }
#cases .case-table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: visible;
}
#cases .case-table {
    table-layout: fixed;
    width: 100%;
    min-width: 0;
    border-collapse: collapse;
    font-size: 11.5px;
}
#cases .case-table thead th {
    min-width: 0 !important;
    width: auto;
    padding: 9px 5px 8px;
    overflow-wrap: anywhere;
    white-space: normal;
}
#cases .case-table thead th:nth-child(1) { width: 11%; }
#cases .case-table thead th:nth-child(2) { width: 17%; }
#cases .case-table thead th:nth-child(3) { width: 13%; }
#cases .case-table thead th:nth-child(4) { width: 8%; }
#cases .case-table thead th:nth-child(5) { width: 13%; }
#cases .case-table thead th:nth-child(6) { width: 15%; }
#cases .case-table thead th:nth-child(7) { width: 10%; }
#cases .case-table thead th:nth-child(8) { width: 13%; }
#cases .case-table .case-th-label {
    min-height: 36px;
    padding: 0 1px 5px;
    font-size: 11px;
    line-height: 1.4;
}
#cases .case-th-hint { display: none; }
#cases .case-table .table-filter {
    width: 100%;
    min-width: 0;
    height: 30px;
    padding: 4px 5px;
    font-size: 10.5px;
    text-overflow: ellipsis;
}
#cases .case-table tbody td {
    min-width: 0;
    padding: 10px 5px;
    height: auto;
    line-height: 1.65;
    vertical-align: middle;
    overflow-wrap: anywhere;
}
#cases .case-table .case-owner,
#cases .case-table .case-engineer { min-width: 0; overflow-wrap: anywhere; }
#cases .case-table .case-number {
    white-space: nowrap;
    font-size: 10.7px;
    letter-spacing: -.15px;
}
#cases .case-table .case-reference { overflow-wrap: anywhere; font-size: 11px; }
#cases .case-table .case-actions { text-align: center; }
#cases .case-table .table-action {
    padding: 4px 6px;
    border-radius: 5px;
    font-size: 10px;
    line-height: 1.5;
    max-width: 100%;
    white-space: normal;
}
#cases .case-table .table-action-muted {
    font-size: 10px;
    white-space: normal;
    overflow-wrap: anywhere;
}
#cases .payment-badge {
    padding: 3px 5px;
    white-space: normal;
    font-size: 10.5px;
    line-height: 1.5;
    text-align: center;
}
@media (max-width: 1050px) {
    #cases .case-table-wrap { overflow: visible; border: none; border-radius: 0; }
    #cases .case-table {
        display: block;
        width: 100%;
        min-width: 0;
        table-layout: auto;
        border-collapse: separate;
    }
    #cases .case-table thead { display: block; margin-bottom: 13px; }
    #cases .case-table thead tr {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 9px;
    }
    #cases .case-table thead th {
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
        width: 100% !important;
        min-width: 0 !important;
        padding: 7px;
        border: 1px solid var(--line);
        border-radius: 7px;
        background: var(--surface);
    }
    #cases .case-table .case-th-label {
        display: block;
        min-height: auto;
        padding-bottom: 5px;
        font-size: 11px;
    }
    #cases .case-table thead th:nth-child(7),
    #cases .case-table thead th:nth-child(8) { display: none; }
    #cases .case-table .table-filter { height: 35px; font-size: 12px; padding-inline: 8px; }
    #cases .case-table tbody {
        display: grid;
        gap: 12px;
    }
    #cases .case-table tbody tr {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0;
        padding: 7px 12px;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: var(--surface);
    }
    #cases .case-table tbody tr:nth-child(even) { background: var(--surface); }
    #cases .case-table tbody td {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: flex-start;
        gap: 4px;
        min-width: 0;
        min-height: 55px;
        height: auto;
        padding: 8px 7px;
        border-bottom: 1px solid var(--line);
        font-size: 12px;
        text-align: right;
        direction: rtl;
    }
    #cases .case-table tbody td:nth-child(1)::before { content: "شناسه اشتراک"; }
    #cases .case-table tbody td:nth-child(2)::before { content: "نام مالک"; }
    #cases .case-table tbody td:nth-child(3)::before { content: "شماره موبایل"; }
    #cases .case-table tbody td:nth-child(4)::before { content: "تعداد انشعاب"; }
    #cases .case-table tbody td:nth-child(5)::before { content: "وضعیت پرداخت"; }
    #cases .case-table tbody td:nth-child(6)::before { content: "مهندس ناظر"; }
    #cases .case-table tbody td:nth-child(7)::before { content: "عملیات"; }
    #cases .case-table tbody td:nth-child(8)::before { content: "جزئیات"; }
    #cases .case-table tbody td::before {
        font-size: 10.5px;
        font-weight: 600;
        line-height: 1.5;
        color: var(--muted);
    }
    #cases .case-table .case-number { white-space: nowrap; font-size: 12px; }
    #cases .case-table .case-count { text-align: right; }
    #cases .case-table .case-actions { text-align: right; align-items: flex-start; }
    #cases .case-table .table-action { font-size: 11.5px; padding: 5px 12px; white-space: nowrap; }
    #cases .case-table .table-action-muted { font-size: 11px; }
    #cases .payment-badge { font-size: 11px; white-space: nowrap; }
}
@media (max-width: 650px) {
    #cases.cases-section { padding: 20px 12px; }
    #cases .case-table thead tr { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    #cases .case-table tbody tr { padding: 6px; }
    .page:not(.page-narrow) { padding-inline: 12px; }
}
@media (max-width: 430px) {
    #cases .case-table tbody tr { grid-template-columns: minmax(0, 1fr); }
    #cases .case-table tbody td { min-height: 48px; }
}

/* Signed-in user controls / login / password change */
.account-menu {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    margin-inline-end: 8px;
    padding-inline-end: 10px;
    border-inline-end: 1px solid var(--line);
}
.account-nickname {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    font-size: 12px;
    color: var(--ink);
    max-width: 205px;
    overflow-wrap: anywhere;
}
.account-avatar {
    flex: 0 0 25px;
    width: 25px;
    height: 25px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--teal-soft);
    color: var(--teal-dark);
    font-size: 14px;
}
.account-action {
    border: 1px solid var(--line);
    border-radius: 5px;
    padding: 5px 7px;
    font-size: 11px;
    color: var(--teal-dark);
    background: var(--surface);
    white-space: nowrap;
}
.account-action:hover,.account-action:focus-visible { background: var(--teal-soft); }
.account-logout { color: #ae3e4e; }
.auth-page { display: flex; align-items: flex-start; justify-content: center; }
.auth-card { width: 100%; max-width: 440px; display: grid; gap: 19px; padding: 36px; }
.auth-card h1 { font-size: 23px; line-height: 1.5; margin: -9px 0 0; }
.auth-hint { font-size: 12px; line-height: 1.8; color: var(--muted); margin: -11px 0 2px; }
.auth-card .alert { margin: 0; }
.auth-card .field { gap: 7px; }
.auth-submit { width: 100%; }
html[data-theme="dark"] .account-avatar { background: #285454; color: #bdf0e8; }
html[data-theme="dark"] .account-action { background: #203642; border-color: #48626e; color: #a5e2df; }
html[data-theme="dark"] .account-logout { color: #ff9eae; }
html[data-theme="dark"] .account-action:hover { background: #2b5258; }
@media(max-width: 720px) {
    .account-menu { margin-inline-end: 0; padding-inline-end: 0; border-inline-end: none; }
    .account-nickname { max-width: 170px; font-size: 11px; }
}
@media(max-width: 450px) {
    .auth-card { padding: 24px 20px; }
    .account-menu { gap: 5px; }
    .account-action { font-size: 10px; padding: 4px 6px; }
}
/* Keep the user nickname and account actions at the top-left of the header. */
.header-actions .account-menu { order: 3; }

/* Changing supervisors: compact grid action and accessible modal */
#cases .case-engineer .change-engineer-trigger {
    display: block;
    width: fit-content;
    margin-top: 7px;
    color: var(--teal-dark);
    cursor: pointer;
}
.engineer-modal-backdrop {
    position: fixed;
    inset: 0;
    padding: 20px;
    z-index: 1200;
    background: rgba(12,31,42,.7);
    display: none;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
}
.engineer-modal-active { overflow: hidden; }
.engineer-modal-dialog {
    box-sizing: border-box;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 25px;
    width: min(490px,100%);
    max-height: calc(100dvh - 40px);
    overflow-y: auto;
    box-shadow: 0 24px 70px rgba(0,0,0,.3);
}
.engineer-modal-heading { display:flex; justify-content:space-between; align-items:center; gap:12px; }
.engineer-modal-heading h3 { font-size:18px; margin:0; color:var(--ink); }
.engineer-modal-close {
    display: inline-flex;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    color: var(--ink);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    width: 32px; height: 32px;
    font-size: 22px;
}
.engineer-modal-help { color:var(--muted); font-size:12px; margin:12px 0; }
.engineer-modal-help strong {color:var(--ink);}
.engineer-modal-dialog .field { margin-top:18px; }
.engineer-modal-dialog textarea { width:100%; box-sizing:border-box; min-height:95px; resize:vertical; }
.engineer-modal-actions { display:flex; justify-content:flex-end; gap:10px; margin-top:20px; flex-wrap:wrap; }
.engineer-replacement-feedback { margin-top:10px; }
html[data-theme="dark"] .engineer-modal-dialog { background: #1b2d39; }
html[data-theme="dark"] .engineer-modal-close { background:#263f4d; }

/* Multi-receipt accounting and incremental-connection actions, no extra grid column. */
#cases .case-count .increase-trigger {
    display:block;
    padding:3px 8px;
    margin:6px auto 0;
    font-size:10.5px;
    white-space:nowrap;
    cursor:pointer;
}
#cases .case-count .count-pending-note {
    display:block;
    font-size:10px;
    line-height:1.55;
    font-weight:600;
    color:var(--teal-dark);
    margin-top:4px;
}
.receipt-history {
    margin-top:18px;
    border:1px solid var(--line);
    border-radius:10px;
    padding:15px;
    background:var(--surface);
}
.receipt-history-heading {
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:12px;
    flex-wrap:wrap;
    border-bottom:1px solid var(--line);
    margin-bottom:14px;
    padding-bottom:12px;
}
.receipt-history-heading h3 {margin:0;font-size:15px;color:var(--ink);}
.receipt-history-heading>span {font-size:12px;color:var(--muted);}
.receipt-history-heading strong {color:var(--ink);}
.receipt-history-row {
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    column-gap:14px;
    row-gap:10px;
    margin-top:10px;
    border:1px solid var(--line);
    border-radius:8px;
    padding:12px;
    background:var(--surface);
}
.receipt-history-row:not(:first-child){margin-top:11px;}
.receipt-history-item {
    display:flex;flex-direction:column;gap:4px;
    min-width:0;
}
.receipt-history-item span {font-size:11px;color:var(--muted);}
.receipt-history-item strong {
    font-size:12px;
    overflow-wrap:anywhere;
    direction:auto;
    color:var(--ink);
}
.receipt-history-demo {grid-column:1/-1;font-size:11px;color:var(--muted);}
html[data-theme="dark"] .receipt-history-row {background:#233b49;}
@media(max-width:420px){
    .receipt-history-row {grid-template-columns:minmax(0,1fr);}
    #cases .case-count .increase-trigger {margin-inline:0;}
}

/* Compact accessible account dropdown and icon-only theme switch. */
.sr-only {
    position:absolute !important;
    width:1px !important;
    height:1px !important;
    overflow:hidden !important;
    clip:rect(0,0,0,0) !important;
    white-space:nowrap !important;
    padding:0 !important;
    margin:-1px !important;
    border:0 !important;
}
.header-actions .account-menu {
    position:relative;
    display:inline-flex;
    flex:0 1 auto;
    align-items:center;
    order:3;
    margin:0;
    padding:0;
    border:0;
    z-index:100;
}
.account-dropdown { position:relative; min-width:0; }
.account-menu-trigger {
    display:inline-flex;
    align-items:center;
    gap:8px;
    height:37px;
    box-sizing:border-box;
    padding:4px 9px;
    background:var(--surface);
    border:1px solid var(--line);
    border-radius:8px;
    cursor:pointer;
    list-style:none;
    color:var(--ink);
    user-select:none;
}
.account-menu-trigger::-webkit-details-marker { display:none; }
.account-menu-trigger::marker { content:""; }
.account-menu-trigger:hover,
.account-dropdown[open] > .account-menu-trigger { border-color:var(--teal); background:var(--teal-soft); }
.account-menu-trigger:focus-visible { outline:3px solid #71bdc2; outline-offset:2px; }
.account-menu-trigger .account-avatar {
    width:26px;
    height:26px;
    flex:0 0 26px;
    border-radius:7px;
}
.account-menu-trigger .account-avatar svg { height:19px; width:19px; }
.account-menu-trigger .account-nickname {
    font-size:12px;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
    max-width:165px;
    min-width:0;
    display:inline-block;
    line-height:1.6;
}
.account-menu-chevron { height:14px; width:14px; flex:none; color:var(--muted); transition:transform .15s ease; }
.account-dropdown[open] .account-menu-chevron { transform:rotate(180deg); }
.account-dropdown:not([open]) > .account-dropdown-panel { display:none; }
.account-dropdown-panel {
    position:absolute;
    top:calc(100% + 7px);
    left:0;
    min-width:205px;
    max-width:min(280px,calc(100vw - 32px));
    z-index:1050;
    background:var(--surface);
    border:1px solid var(--line);
    border-radius:10px;
    box-shadow:0 14px 30px rgba(10,30,43,.2);
    padding:6px;
    display:flex;
    flex-direction:column;
    gap:3px;
}
.account-dropdown-item {
    display:flex;
    align-items:center;
    gap:10px;
    padding:11px 12px;
    border-radius:7px;
    line-height:1.6;
    font-size:12px;
    font-weight:600;
    color:var(--ink);
    text-decoration:none;
    white-space:nowrap;
}
.account-dropdown-item svg { height:19px; width:19px; flex:none; color:var(--muted); }
.account-dropdown-item:hover,
.account-dropdown-item:focus-visible { background:var(--teal-soft); color:var(--teal-dark); }
.account-dropdown-item:focus-visible { outline:2px solid var(--teal); outline-offset:-2px; }
.account-dropdown-divider { height:1px; background:var(--line); margin:4px 6px; }
.account-dropdown-logout,
.account-dropdown-logout svg { color:#bb4757; }
html[data-theme="dark"] .account-menu-trigger { background:#203642; border-color:#415b68; color:#e7f4f8; }
html[data-theme="dark"] .account-menu-trigger:hover,
html[data-theme="dark"] .account-dropdown[open] > .account-menu-trigger { background:#244e51; border-color:#5eaaa2; }
html[data-theme="dark"] .account-dropdown-panel { background:#1b2e3a; border-color:#48616d; box-shadow:0 14px 35px rgba(0,0,0,.4); }
html[data-theme="dark"] .account-dropdown-item { color:#ecf7fa; }
html[data-theme="dark"] .account-dropdown-item:hover { background:#254b51; color:#9ff1e5; }
html[data-theme="dark"] .account-dropdown-logout,
html[data-theme="dark"] .account-dropdown-logout svg { color:#ffa5ae; }
.theme-toggle.theme-toggle-icon {
    width:37px;
    min-width:37px;
    height:37px;
    min-height:37px;
    padding:0;
    border-radius:8px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    position:relative;
    flex:none;
}
.theme-toggle-icon .theme-icon {
    width:19px;
    height:19px;
    flex:none;
    color:var(--teal-dark);
}
.theme-toggle-icon .theme-icon-sun { display:none; }
html[data-theme="dark"] .theme-toggle-icon .theme-icon-moon { display:none; }
html[data-theme="dark"] .theme-toggle-icon .theme-icon-sun { display:block; color:#f8cf79; }
@media (max-width:650px) {
    .theme-toggle.theme-toggle-icon { width:36px; min-width:36px; height:36px; min-height:36px; }
    .account-menu-trigger { height:36px; gap:5px; padding:3px 6px; }
    .account-menu-trigger .account-nickname { max-width:112px; font-size:11px; }
    .account-dropdown-panel { min-width:190px; }
}
@media(max-width:380px) {
    .account-menu-trigger .account-nickname { max-width:80px; }
    .account-dropdown-panel { max-width:calc(100vw - 22px); }
}

/* Role-3-only supervisor reassignment audit in the tracking details. */
.tracking-history-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
}
.tracking-history-heading { margin-bottom: 15px; }
.tracking-history-heading h2 {
    font-size: 17px;
    line-height: 1.65;
    color: var(--ink);
    margin: 5px 0;
}
.tracking-history-heading p {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.85;
    margin: 0;
}
.tracking-history-empty {
    border: 1px dashed var(--line);
    border-radius: 8px;
    padding: 18px;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}
.tracking-history-scroll {
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow-x: auto;
}
.tracking-history-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    text-align: right;
    font-size: 12px;
}
.tracking-history-table th,
.tracking-history-table td {
    padding: 12px 10px;
    vertical-align: middle;
    border-bottom: 1px solid var(--line);
    line-height: 1.85;
    overflow-wrap: anywhere;
}
.tracking-history-table th {
    font-weight: 700;
    font-size: 11px;
    color: var(--ink);
    background: var(--teal-soft);
}
.tracking-history-table th:nth-child(1) { width: 27%; }
.tracking-history-table th:nth-child(2) { width: 22%; }
.tracking-history-table th:nth-child(3) { width: 31%; }
.tracking-history-table th:nth-child(4) { width: 20%; }
.tracking-history-table tbody tr:last-child td { border-bottom: 0; }
.tracking-history-table tbody tr:nth-child(even) { background: var(--surface-soft, var(--surface)); }
.tracking-history-table .tracking-history-date {
    direction: ltr;
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.tracking-history-table .tracking-history-reason { white-space: pre-line; }
html[data-theme="dark"] .tracking-history-table th {
    background: #28454c;
    color: #e8f8f6;
}
@media (max-width: 620px) {
    .tracking-history-scroll { border: 0; overflow: visible; }
    .tracking-history-table,
    .tracking-history-table tbody,
    .tracking-history-table tr,
    .tracking-history-table td { display: block; width: 100%; box-sizing: border-box; }
    .tracking-history-table thead { display: none; }
    .tracking-history-table tbody tr {
        border: 1px solid var(--line);
        border-radius: 8px;
        margin-bottom: 10px;
        padding: 7px 12px;
        background: var(--surface);
    }
    .tracking-history-table td {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 12px;
        text-align: right;
        border-bottom: 1px dashed var(--line);
        padding: 9px 2px;
        font-size: 12px;
        line-height: 1.7;
        white-space: normal;
    }
    .tracking-history-table td:last-child { border-bottom: 0; }
    .tracking-history-table td::before {
        content: attr(data-label);
        flex: 0 0 38%;
        font-size: 11px;
        font-weight: 600;
        color: var(--muted);
        text-align: right;
    }
    .tracking-history-table .tracking-history-date { white-space: normal; direction: rtl; }
    .tracking-history-table tbody tr:nth-child(even) { background: var(--surface); }
}
