
:root{
--maroon:#7a1317;
--red:#c12428;
--grad:linear-gradient(135deg,#7a1317 0%,#c12428 100%);
--bg:#f4f6f8;
--surface:#ffffff;
--ink:#22262b;
--muted:#6b7280;
--line:#e5e7eb;
--green:#0f9d58;
--amber:#b45309;
--blue:#1d4ed8;
--radius:14px;
--shadow:0 6px 24px rgba(30,10,12,.08);
}
.patient-list-footer{display:flex;align-items:center;justify-content:center;gap:12px;flex-wrap:wrap;padding:16px;min-height:64px}
*{box-sizing:border-box;margin:0;padding:0}
html{scroll-behavior:smooth}
body{
font-family:'Inter', sans-serif;
background:var(--bg);
color:var(--ink);
min-height:100vh;
font-size:14.5px;
}
html[lang="ar"] body{font-family:'Readex Pro','Inter',sans-serif}
.hidden{display:none!important}
.muted{color:var(--muted)}
.sm{font-size:12px}
.txt-green{color:var(--green)}
.txt-red{color:var(--red)}
.txt-amber{color:var(--amber)}

.logo{
width:46px;height:46px;border-radius:14px;background:var(--grad);
color:#fff;display:flex;align-items:center;justify-content:center;
font-weight:700;font-size:22px;box-shadow:0 6px 16px rgba(122,19,23,.35);flex-shrink:0;
}
.logo.on-grad{background:rgba(255,255,255,.16);box-shadow:none;border:1px solid rgba(255,255,255,.35)}
.logo.big{width:64px;height:64px;font-size:30px;border-radius:18px;margin:0 auto 12px}

.logo-img{
    width:46px;
    height:46px;
    border-radius:14px;
    object-fit:contain;
    box-shadow:0 6px 16px rgba(122,19,23,.35);
    flex-shrink:0;
    background:rgba(255,255,255,.95);
    padding:4px;
}
.logo-img.big{
    width:90px;
    height:90px;
    border-radius:22px;
    margin:0 auto 16px;
    display:block;
    padding:8px;
    background:#fff;
    box-shadow:0 10px 30px rgba(0,0,0,.2);
}

.logo-img{
    width:46px;
    height:46px;
    border-radius:14px;
    object-fit:contain;
    box-shadow:0 6px 16px rgba(122,19,23,.35);
    flex-shrink:0;
    background:rgba(255,255,255,.95);
    padding:4px;
}
.logo-img.big{
    width:90px;
    height:90px;
    border-radius:22px;
    margin:0 auto 16px;
    display:block;
    padding:8px;
    background:#fff;
    box-shadow:0 10px 30px rgba(0,0,0,.2);
}

#app-header{
background:var(--grad);
color:#fff;
position:sticky;
top:0;
z-index:60;
box-shadow:0 4px 20px rgba(122,19,23,.35);
}
.header-inner{
max-width:1200px;margin:auto;display:flex;justify-content:space-between;
align-items:center;gap:12px;padding:13px 16px;flex-wrap:wrap;
}
.brand{display:flex;align-items:center;gap:12px}
.brand-name{font-weight:700;font-size:17px}
.brand-sub{font-size:11.5px;opacity:.85}
.header-user{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.user-chip{
display:flex;align-items:center;gap:9px;background:rgba(255,255,255,.15);
padding:7px 14px;border:1px solid rgba(255,255,255,.28);border-radius:999px;
font:inherit;font-size:13px;color:#fff;cursor:pointer;transition:.2s;
}
.user-chip:hover,.user-chip[aria-expanded="true"]{background:rgba(255,255,255,.23)}
.user-chip:focus-visible{outline:3px solid rgba(255,255,255,.55);outline-offset:2px}
.role-tag{background:#fff;color:var(--maroon);padding:2px 10px;border-radius:999px;font-size:11px;font-weight:700}
.account-menu{position:relative}
.account-chevron{font-size:10px;transition:transform .2s}
.user-chip[aria-expanded="true"] .account-chevron{transform:rotate(180deg)}
.account-dropdown{
position:absolute;top:calc(100% + 9px);inset-inline-end:0;width:min(320px,calc(100vw - 32px));
padding:14px;background:#fff;color:var(--ink);border:1px solid var(--line);border-radius:14px;
box-shadow:0 18px 45px rgba(34,20,21,.2);z-index:90;text-align:start;
}
.account-profile{padding:3px 4px 12px;border-bottom:1px solid var(--line);margin-bottom:10px}
.account-profile-name{display:block;font-size:14px}
.account-profile-email{display:block;margin-top:4px;color:var(--muted);font-size:12px;direction:ltr;word-break:break-all}
.account-menu-actions{display:grid;gap:8px}
.account-menu-actions .btn{width:100%;justify-content:flex-start}

.tabbar{
display:flex;gap:4px;max-width:1200px;margin:auto;padding:0 12px;overflow-x:auto;
}
.tab{
background:transparent;border:none;color:rgba(255,255,255,.85);
padding:12px 16px;font-family:inherit;font-size:13.5px;font-weight:600;
cursor:pointer;border-bottom:3px solid transparent;white-space:nowrap;
display:flex;align-items:center;
}
.tab:hover{color:#fff;background:rgba(255,255,255,.08)}
.tab.active{
color:#fff;border-bottom-color:#fff;background:rgba(255,255,255,.13);
border-radius:10px 10px 0 0;
}
.tab .pill{
background:#fff;color:var(--maroon);border-radius:999px;font-size:10.5px;
padding:1px 7px;margin-inline-start:6px;font-weight:700;
}
.tab .pill:empty{display:none}

main{max-width:1200px;margin:24px auto;padding:0 16px;min-height:62vh}
main.beneficiary-list-page{max-width:1600px}
.table.beneficiary-table{min-width:1500px}
.table.admin-patients-table{min-width:1180px;table-layout:fixed}
.patient-source{max-width:100%;min-width:0;margin-top:5px}
.badge.patient-source-badge{display:block;max-width:100%;box-sizing:border-box;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.patient-source-number{max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.admin-patients-table th,.admin-patients-table td{padding-block:5px;padding-inline:8px;border-inline-end:1px solid #edf0f3;overflow-wrap:normal;word-break:normal;hyphens:none}
.admin-patients-table th{white-space:normal;line-height:1.4}
.admin-patients-table .col-actions{border-inline-end:0}
.admin-patients-table .col-age,.admin-patients-table .col-product{display:none}
.admin-patients-table .col-beneficiary-number{width:7%}
.admin-patients-table .col-beneficiary{width:10%}
.admin-patients-table .col-facility{width:7%}
.admin-patients-table .col-referrals{width:9%}
.admin-patients-table .col-gender{width:4%}
.admin-patients-table .col-nationality{width:6%}
.admin-patients-table .col-phone{width:8%}
.admin-patients-table .col-condition{width:14%}
.admin-patients-table .col-stage{width:7%}
.admin-patients-table .col-specialist{width:10%}
.admin-patients-table .col-created{width:7%}
.admin-patients-table .col-record-status{width:6%}
.admin-patients-table .col-actions{width:5%;text-align:center}
.admin-patients-table .col-condition .product-tone{max-width:100%}
.admin-patients-table .referral-entities{min-width:0}
.admin-patients-table .referral-entity{max-width:100%;padding-inline:7px;overflow-wrap:normal;word-break:normal}
.admin-patients-table .product-tone{overflow-wrap:normal;word-break:normal}
.admin-patients-table .col-facility .badge,.admin-patients-table .col-specialist .badge,.admin-patients-table .col-record-status .badge{white-space:normal;text-align:center;justify-content:center}
.admin-patients-table td .badge{max-width:100%;box-sizing:border-box}
.admin-patients-table .col-stage .badge{display:flex;width:100%;max-width:100%;padding-inline:4px;white-space:normal;overflow-wrap:normal;word-break:normal;hyphens:none;text-align:center;justify-content:center}
.admin-patients-table td.col-beneficiary-number,.admin-patients-table td.col-phone{white-space:nowrap;font-size:12px;font-variant-numeric:tabular-nums;direction:ltr;text-align:center}
.admin-patients-table td.col-created{white-space:nowrap}
.patient-created-date{display:inline-flex;flex-direction:column;align-items:center;gap:1px;line-height:1.2;direction:ltr;white-space:nowrap}
.patient-created-date-year{font-size:11px;color:var(--muted);font-weight:600}
.patient-name-link{appearance:none;border:0;background:transparent;color:var(--ink);font:inherit;font-weight:700;text-align:start;cursor:pointer;padding:2px 0;border-radius:4px}
.patient-name-link:hover,.patient-name-link:focus-visible{color:var(--red);text-decoration:underline;outline:none}
.patient-actions-trigger{width:34px;height:34px;padding:0;border-radius:9px;font-size:20px;line-height:1;font-weight:800}
.patient-actions-summary{display:grid;gap:8px}
.patient-filter-select{width:auto;min-width:0;max-width:240px;field-sizing:content;flex:0 1 auto}
.referral-entities{display:flex;align-items:center;gap:5px;flex-wrap:wrap;min-width:140px}
.referral-entity{display:inline-block;max-width:190px;padding:4px 10px;border-radius:10px;font-size:11.5px;font-weight:700;line-height:1.45;white-space:normal;overflow-wrap:anywhere}
.referral-tone-0{background:#eaf2ff;color:#2457a7}.referral-tone-1{background:#f2ecff;color:#6d3bb7}
.referral-tone-2{background:#e6f7f4;color:#147a69}.referral-tone-3{background:#fff2e5;color:#a8520e}
.referral-tone-4{background:#e8f7fb;color:#176b7d}.referral-tone-5{background:#f8ecf5;color:#8a376c}
.referral-tone-6{background:#f4f5e7;color:#66731b}.referral-tone-7{background:#eceffd;color:#4456a6}
.referral-tone-8{background:#f7eee8;color:#825336}.referral-tone-9{background:#eaf1f4;color:#3f6674}
.referral-more{background:#f1f3f6;color:#596779}
.referral-editor{grid-column:1/-1;border:1px solid var(--line);border-radius:12px;padding:14px;background:#fbfcfe}
.referral-editor-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:10px}
.referral-editor-list{display:grid;gap:10px}
.referral-editor-row{display:grid;grid-template-columns:minmax(170px,1.4fr) minmax(170px,1.4fr) minmax(140px,.8fr) auto;gap:9px;align-items:end;padding:10px;border:1px solid var(--line);border-radius:10px;background:#fff}
.referral-editor-row label{margin:0}
.referral-history{display:grid;gap:9px}
.referral-history-item{padding:11px 13px;border:1px solid var(--line);border-radius:10px;background:#fbfcfe}
.referral-history-meta{display:flex;gap:10px;flex-wrap:wrap;margin-top:6px}
.referral-overview-list{max-height:260px;overflow:auto;padding-inline-end:3px}
.row-cancelled td{background:#fff1f2!important;color:#7f1d1d}
.row-cancelled:hover td{background:#ffe4e6!important}
.cancelled-banner{border:1px solid #fecaca;background:#fff1f2;color:#991b1b;border-radius:12px;padding:14px 16px;line-height:1.8}
.cancelled-banner strong{color:#7f1d1d}
.admin-note{border-inline-start:4px solid var(--maroon);background:#fff8f8}
.admin-note.unread{box-shadow:0 0 0 2px rgba(193,36,40,.13)}
.card{
background:var(--surface);border:1px solid var(--line);
border-radius:var(--radius);box-shadow:var(--shadow);padding:22px;
}
.card h3{font-size:15.5px;margin-bottom:13px}
.grid{display:grid;gap:16px}
.g2{grid-template-columns:repeat(2,1fr)}
.g3{grid-template-columns:repeat(3,1fr)}
.g4{grid-template-columns:repeat(4,1fr)}
.sec-title{display:flex;align-items:center;gap:10px;font-size:20px;margin:4px 0 16px}
.sec-title::before{content:'';width:5px;height:26px;background:var(--grad);border-radius:4px;flex-shrink:0}
.row-between{display:flex;justify-content:space-between;align-items:center;gap:10px}
.row-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.wrap{flex-wrap:wrap}
.center{text-align:center}
.hero{
background:var(--grad);color:#fff;border-radius:var(--radius);
padding:28px;margin-bottom:16px;box-shadow:var(--shadow);
}
.hero h2{margin-bottom:6px;font-size:22px}
.hero p{opacity:.92;font-size:13.5px;max-width:720px;line-height:1.9}

.btn{
font-family:inherit;cursor:pointer;border-radius:10px;padding:10px 18px;
font-weight:600;border:1px solid transparent;transition:.2s;font-size:13.5px;
display:inline-flex;align-items:center;gap:6px;justify-content:center;
}
.btn-primary{background:var(--grad);color:#fff;box-shadow:0 4px 14px rgba(193,36,40,.3)}
.btn-primary:hover{transform:translateY(-1px);box-shadow:0 6px 18px rgba(193,36,40,.4)}
.btn-primary:disabled{opacity:.45;cursor:not-allowed;transform:none;box-shadow:none}
.btn-outline{background:#fff;border-color:var(--maroon);color:var(--maroon)}
.btn-outline:hover{background:#f6e3e4}
.btn-danger{background:#fff;border-color:var(--red);color:var(--red)}
.btn-danger:hover{background:#fdecec}
.btn-light-outline{background:transparent;border-color:rgba(255,255,255,.5);color:#fff}
.btn-light-outline:hover{background:rgba(255,255,255,.15)}
.btn-sm{padding:6px 12px;font-size:12px;border-radius:8px}
.btn-block{width:100%}

input,select,textarea{
font-family:inherit;font-size:13.5px;padding:10px 12px;border:1.5px solid var(--line);
border-radius:10px;background:#fff;width:100%;color:var(--ink);transition:.2s;
}
input:focus,select:focus,textarea:focus{
outline:none;border-color:var(--red);box-shadow:0 0 0 3px rgba(193,36,40,.12);
}
input:disabled{background:#f3f4f6;color:var(--muted)}
label{font-size:12.5px;font-weight:600;color:#374151;display:block}
label input,label select,label textarea{margin-top:6px;font-weight:400}
.form-grid{display:grid;gap:13px}
.form-grid .two{grid-template-columns:1fr 1fr}
.nationality-picker{position:relative;margin-top:6px;font-weight:400}
.nationality-trigger{
font-family:inherit;font-size:13.5px;padding:10px 12px;border:1.5px solid var(--line);
border-radius:10px;background:#fff;width:100%;color:var(--ink);cursor:pointer;
display:flex;align-items:center;justify-content:space-between;gap:10px;text-align:start;
}
.nationality-trigger:hover{border-color:#c9cdd4}
.nationality-trigger:focus,.nationality-trigger[aria-expanded="true"]{
outline:none;border-color:var(--red);box-shadow:0 0 0 3px rgba(193,36,40,.12)
}
.nationality-arrow{color:var(--muted);transition:transform .2s}
.nationality-trigger[aria-expanded="true"] .nationality-arrow{transform:rotate(180deg)}
.nationality-dropdown{
position:absolute;z-index:80;inset-inline:0;top:calc(100% + 6px);background:#fff;
border:1px solid var(--line);border-radius:12px;padding:9px;
box-shadow:0 16px 38px rgba(31,41,55,.18)
}
.nationality-dropdown[hidden]{display:none}
.nationality-search{margin:0 0 8px!important}
.nationality-options{max-height:245px;overflow-y:auto;overscroll-behavior:contain}
.nationality-option{
font-family:inherit;font-size:13px;width:100%;border:0;background:transparent;color:var(--ink);
padding:9px 10px;border-radius:8px;cursor:pointer;display:flex;align-items:center;
justify-content:space-between;gap:12px;text-align:start
}
.nationality-option:hover,.nationality-option:focus{outline:none;background:#f6e3e4}
.nationality-option[hidden]{display:none}
.nationality-option.selected{background:#fdf0f1;color:var(--maroon);font-weight:700}
.nationality-option small{color:var(--muted);font-size:11px;direction:ltr}
.nationality-empty{padding:16px 10px;text-align:center;color:var(--muted);font-size:12px}
.checkline{
display:flex;align-items:center;gap:8px;font-size:13px;font-weight:500;
margin:10px 0;cursor:pointer;
}
.checkline input{width:auto; margin:0}
.export-summary{padding:11px 13px;border-radius:10px;background:#f8f9fb;color:var(--muted);font-size:13px}
.export-select-all{padding:10px 12px;border:1px solid var(--line);border-radius:10px;background:#fff;font-weight:700}
.export-columns{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:8px;margin-top:10px}
.export-column{margin:0;padding:10px 12px;border:1px solid var(--line);border-radius:10px;background:#fff}
.appointment-patient-picker{position:relative;margin-top:6px}
.appointment-patient-results{position:absolute;z-index:20;inset-inline:0;top:calc(100% + 5px);max-height:230px;overflow:auto;background:#fff;border:1px solid var(--line);border-radius:10px;box-shadow:0 14px 35px rgba(0,0,0,.14)}
.appointment-patient-result{display:flex;width:100%;border:0;border-bottom:1px solid var(--line);background:#fff;padding:10px 12px;text-align:start;font:inherit;cursor:pointer;justify-content:space-between;gap:10px}
.appointment-patient-result:last-child{border-bottom:0}
.appointment-patient-result:hover,.appointment-patient-result:focus{outline:none;background:#f6e3e4}
.appointment-patient-result small{color:var(--muted);direction:ltr}
.appointment-patient-result:disabled{cursor:not-allowed;background:#f8f9fb;color:#6b7280;opacity:1}
.appointment-patient-result:disabled:hover,.appointment-patient-result:disabled:focus{background:#f8f9fb}
.appointment-patient-copy{display:flex;min-width:0;flex-direction:column;align-items:flex-start;gap:3px}
.appointment-patient-reason{color:#9f1239!important;direction:inherit!important;font-weight:700}
.appointment-patient-note{color:#1d4ed8!important;direction:inherit!important;font-weight:700}
.appointment-patient-empty{padding:14px;text-align:center;color:var(--muted);font-size:12px}

.table-wrap{overflow-x:auto;margin-top:10px}
.table{width:100%;border-collapse:collapse;font-size:13.5px;min-width:620px}
.table th{
background:#f8f9fb;color:#4b5563;font-size:12px;text-align:start;
padding:11px 12px;border-bottom:2px solid var(--line);white-space:nowrap;
}
.table td{padding:12px;border-bottom:1px solid var(--line);vertical-align:middle}
.table.admin-patients-table th{
white-space:normal;overflow-wrap:normal;word-break:normal;line-height:1.45;
}
.table tbody tr:hover{background:#fafbfc}
.table.center-beneficiaries-table{min-width:1000px}
.center-beneficiaries-heading>div{min-width:0;max-width:100%}
.center-beneficiaries-heading .sec-title{overflow-wrap:anywhere}
.center-beneficiary-number{white-space:nowrap;direction:ltr}
.center-latest-note{min-width:240px;max-width:340px}
.center-latest-note-text{white-space:normal;overflow-wrap:anywhere;line-height:1.6}
.center-latest-note-meta{display:flex;gap:6px;flex-wrap:wrap;align-items:center;margin-top:6px}
.center-stage-correction{display:flex;align-items:center;gap:8px}
.center-stage-correction input{width:auto}
.empty{text-align:center;color:var(--muted);padding:26px!important}
.low-stock td{background:#fdecec!important}
.row-disabled{opacity:.55}

.badge{
display:inline-flex;align-items:center;gap:4px;padding:3px 11px;
border-radius:999px;font-size:11.5px;font-weight:700;white-space:nowrap;
}
.b-green{background:#e7f6ee;color:#0f7a43}
.b-red{background:#fdecec;color:#b31217}
.b-amber{background:#fef3e2;color:#b45309}
.b-blue{background:#e8effd;color:#1d4ed8}
.b-gray{background:#eef1f4;color:#5b6472}
.b-purple{background:#f2ecff;color:#6d3bb7}
.b-teal{background:#e6f7f4;color:#147a69}
.b-maroon{background:#f6e3e4;color:#7a1317}
.gender-badge{display:inline-flex;width:100%;align-items:center;justify-content:center;padding:3px 4px;border-radius:999px;font-size:11.5px;font-weight:700;white-space:nowrap}
.gender-male{background:#e8f1ff;color:#1d4ed8}
.gender-female{background:#fce7f3;color:#9d174d}
.product-tone{display:inline-block;max-width:290px;padding:4px 10px;border-radius:10px;font-size:11.5px;font-weight:700;line-height:1.45;white-space:normal;overflow-wrap:anywhere}
.product-tone-prostheses{background:#eaf2ff;color:#2457a7}
.product-tone-orthoses{background:#e6f7f4;color:#147a69}
.product-tone-braces{background:#f2ecff;color:#6d3bb7}
.product-tone-shoes{background:#fff3df;color:#9a5a08}
.product-tone-burn-garments{background:#fcecef;color:#9b3e55}
.product-tone-assistive-devices{background:#e8f7fb;color:#176b7d}
.product-tone-accessories{background:#edf1f7;color:#53657d}
.product-tone-other{background:#eef1f4;color:#5b6472}
.specialist-tone-0{background:#eaf2ff;color:#2457a7}.specialist-tone-1{background:#f2ecff;color:#6d3bb7}
.specialist-tone-2{background:#e6f7f4;color:#147a69}.specialist-tone-3{background:#fff2e5;color:#a8520e}
.specialist-tone-4{background:#e8f7fb;color:#176b7d}.specialist-tone-5{background:#f8ecf5;color:#8a376c}
.specialist-tone-6{background:#f4f5e7;color:#66731b}.specialist-tone-7{background:#eceffd;color:#4456a6}
.specialist-tone-8{background:#f7eee8;color:#825336}.specialist-tone-9{background:#eaf1f4;color:#3f6674}
.facility-tone-makkah{background:#e8f7fb;color:#176b7d}
.facility-tone-senad{background:#fff2e5;color:#a8520e}
.facility-tone-external{background:#f2ecff;color:#6d3bb7}

.alert{
padding:12px 15px;border-radius:11px;font-size:13px;margin-bottom:14px;line-height:1.8;
}
.alert-success{background:#e7f6ee;color:#0f7a43;border:1px solid #bfe8d1}
.alert-danger{background:#fdecec;color:#b31217;border:1px solid #f5c6c9}
.alert-warning{background:#fef3e2;color:#92400e;border:1px solid #f5ddb8}
.alert-info{background:#e8effd;color:#1d4ed8;border:1px solid #c4d4f7}

.stat{display:flex;gap:14px;align-items:flex-start}
.stat-icon{
width:48px;height:48px;border-radius:14px;background:#f6e3e4;
display:flex;align-items:center;justify-content:center;font-size:22px;flex-shrink:0;
}
.stat-label{font-size:12px;color:var(--muted);margin-bottom:4px}
.stat-value{font-size:15.5px;font-weight:700;margin-bottom:3px}
.progress{height:12px;background:#edf0f3;border-radius:999px;overflow:hidden;margin:10px 0}
.progress-fill{height:100%;background:var(--grad);border-radius:999px;transition:width .6s}
.big-pct{font-size:34px;font-weight:700;color:var(--maroon)}
.delivery-indicator{--delivery-color:#b42318;--delivery-track:#fdecec}
.delivery-indicator.delivery-mid{--delivery-color:#b45309;--delivery-track:#fef3e2}
.delivery-indicator.delivery-good{--delivery-color:#15803d;--delivery-track:#e7f6ee}
.delivery-indicator .big-pct{color:var(--delivery-color)}
.delivery-indicator .progress{background:var(--delivery-track)}
.delivery-indicator .progress-fill{background:var(--delivery-color)}
.overview-appointment-copy{display:flex;align-items:center;flex-wrap:wrap;gap:6px;min-width:0}
.overview-appointment-name,.overview-appointment-date,.overview-appointment-time{display:inline-flex;align-items:center;padding:4px 9px;border-radius:9px;font-weight:700;line-height:1.35}
.overview-appointment-name{background:#eaf2ff;color:#2457a7}
.overview-appointment-date{background:#f2ecff;color:#6d3bb7}
.overview-appointment-time{background:#fff2e5;color:#a8520e;direction:ltr}
.mini-row{
display:flex;justify-content:space-between;gap:10px;padding:9px 0;
border-bottom:1px dashed var(--line);font-size:13px;align-items:center;
}
.mini-row:last-child{border-bottom:none}
.kv{
display:flex;justify-content:space-between;gap:10px;padding:11px 0;
border-bottom:1px dashed var(--line);font-size:13.5px;align-items:center;
}
.kv:last-child{border-bottom:none}
.kv span{color:var(--muted)}

#login-screen{
min-height:100vh;display:flex;align-items:center;justify-content:center;
background:var(--grad);position:relative;padding:20px;
}
#login-screen::before{
content:'';position:absolute;inset:0;
background:
radial-gradient(circle at 18% 22%,rgba(255,255,255,.13),transparent 42%),
radial-gradient(circle at 82% 75%,rgba(255,255,255,.1),transparent 45%);
}
.login-card{
position:relative;background:#fff;border-radius:22px;
box-shadow:0 30px 80px rgba(0,0,0,.35);width:min(440px,100%);
padding:36px 32px;text-align:center;
}
.login-card h1{font-size:21px;color:var(--maroon);margin-bottom:2px}
.login-card .sub{font-size:12.5px;color:var(--muted);margin-bottom:18px}
.login-card form{text-align:start}
.login-card form label{margin-bottom:12px}
.usage-terms{
font-size:11px;line-height:1.7;color:var(--muted);margin-top:12px;text-align:center;
}
.usage-terms a{color:var(--maroon);font-weight:700;text-decoration:underline;text-underline-offset:2px}
.server-status{
font-size:11.5px;margin-bottom:14px;padding:8px 12px;background:#f4f6f8;border-radius:9px;
}
#login-error{margin-top:4px}

.report-item{
border:1px solid var(--line);border-radius:12px;padding:12px 14px;
margin-top:10px;background:#fbfbfc;
}
.report-item p{margin-top:6px;font-size:13px;line-height:1.8}
.report-list{margin-top:14px;max-height:360px;overflow:auto}
.report-product{
display:flex;align-items:center;gap:8px;margin-top:8px;padding:7px 10px;
background:#f6e3e4;border-radius:9px;color:var(--maroon);font-size:12px;font-weight:600;
}
.report-product-customization{
margin-top:7px;padding:7px 10px;border-inline-start:3px solid #d9a4a6;
background:#fff8f8;border-radius:7px;font-size:12px;line-height:1.7;color:#4b5563;
}
.product-field{margin:6px 0 0;border:0;padding:0;min-width:0}
.product-field legend{font-size:12.5px;font-weight:600;color:#374151;margin-bottom:6px}
.product-select-button{
width:100%;min-height:46px;border:1.5px dashed #c8cdd4;background:#fafbfc;color:#374151;
border-radius:11px;padding:10px 12px;display:flex;align-items:center;justify-content:space-between;
gap:10px;text-align:start;cursor:pointer;font:inherit;
}
.product-select-button:hover{border-color:var(--red);background:#fff7f7}
.product-select-button.has-value{border-style:solid;border-color:#d9a4a6;background:#fff}
.product-selected-main{display:flex;align-items:center;gap:9px;min-width:0}
.product-selected-copy{min-width:0}
.product-selected-name{font-size:13px;font-weight:700;color:var(--ink);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.product-selected-meta{font-size:11px;color:var(--muted);margin-top:2px}
.product-picker-search{position:sticky;top:-20px;z-index:3;background:#fff;padding:0 0 12px}
.product-category-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:9px;margin:8px 0 15px}
.product-category{
border:1px solid var(--line);background:#fff;border-radius:12px;padding:11px 9px;cursor:pointer;
font:inherit;color:var(--ink);display:flex;flex-direction:column;align-items:center;gap:4px;
}
.product-category:hover,.product-category.active{border-color:var(--red);background:#fff5f5;color:var(--maroon)}
.product-category-icon{font-size:23px}.product-category-count{font-size:10.5px;color:var(--muted)}
.product-subcategories{display:flex;gap:7px;flex-wrap:wrap;margin:7px 0 14px}
.product-subcategory{
border:1px solid var(--line);background:#fff;border-radius:999px;padding:6px 11px;cursor:pointer;
font:inherit;font-size:11.5px;color:#4b5563;
}
.product-subcategory.active{background:var(--maroon);border-color:var(--maroon);color:#fff}
.product-results{display:grid;gap:8px;max-height:320px;overflow:auto;padding:2px}
.product-option{
width:100%;border:1px solid var(--line);background:#fff;border-radius:11px;padding:10px 12px;
display:flex;align-items:center;justify-content:space-between;gap:10px;text-align:start;cursor:pointer;font:inherit;
}
.product-option:hover,.product-option.selected{border-color:var(--red);background:#fff6f6}
.product-option-name{font-size:12.5px;font-weight:600}.product-option-path{font-size:10.5px;color:var(--muted);margin-top:2px}
.product-code{font-family:ui-monospace,SFMono-Regular,Consolas,monospace;background:#eef1f4;color:#4b5563;padding:3px 7px;border-radius:7px;font-size:10.5px;white-space:nowrap}
.product-empty{text-align:center;color:var(--muted);padding:28px 12px}
.notif{
display:flex;gap:12px;background:#fff;border:1px solid var(--line);
border-radius:12px;padding:14px 16px;margin-bottom:10px;
box-shadow:0 2px 8px rgba(0,0,0,.04);
}
.notif .n-icon{font-size:22px}
.notif .n-title{font-weight:700;font-size:13.5px}
.notif .n-body{font-size:12.5px;color:var(--muted)}
.edu-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(290px,1fr));gap:16px}
.edu-card .edu-icon{font-size:34px;margin-bottom:8px}
.edu-card ol{margin:10px 0 0 18px;line-height:2.1;font-size:13px}
.filters{display:flex;gap:10px;flex-wrap:wrap;margin-bottom:6px}
.filters select,.filters input{width:auto;min-width:165px}

#modal-overlay{
position:fixed;inset:0;background:rgba(20,10,12,.55);
display:none;align-items:center;justify-content:center;z-index:150;padding:18px;
}
#modal-overlay.show{display:flex}
.modal{
background:#fff;border-radius:18px;width:min(680px,100%);max-height:90vh;
display:flex;flex-direction:column;box-shadow:0 30px 80px rgba(0,0,0,.35);
animation:pop .25s;
}
@keyframes pop{from{transform:scale(.94);opacity:0}to{transform:scale(1);opacity:1}}
.modal-head{
display:flex;justify-content:space-between;align-items:center;
padding:15px 20px;background:var(--grad);color:#fff;
border-radius:18px 18px 0 0;gap:10px;
}
.modal-head h3{font-size:15px}
.modal-x{
background:rgba(255,255,255,.22);border:none;color:#fff;width:30px;height:30px;
border-radius:8px;cursor:pointer;font-size:15px;flex-shrink:0;
}
.modal-body{padding:20px;overflow:auto}
.modal-foot{padding:14px 20px;border-top:1px solid var(--line);display:flex;gap:10px;flex-wrap:wrap}

#toast-root{
position:fixed;bottom:18px;inset-inline-start:18px;z-index:300;display:flex;
flex-direction:column;gap:10px;
}
.language-switch{
display:inline-flex;align-items:center;justify-content:center;gap:7px;
min-width:92px;direction:ltr
}
.login-language{position:absolute;top:16px;inset-inline-end:16px;z-index:2}
.toast{
background:#23272e;color:#fff;padding:12px 18px;border-radius:12px;
box-shadow:0 10px 30px rgba(0,0,0,.28);font-size:13px;opacity:0;
transform:translateY(12px);transition:.3s;max-width:350px;
border-inline-start:4px solid var(--red);line-height:1.7;
}
.toast.show{opacity:1;transform:none}
.t-success{border-inline-start-color:var(--green)}
.t-error{border-inline-start-color:#ff5d6c}
.t-info{border-inline-start-color:#3b82f6}

.loading{padding:70px;text-align:center;color:var(--muted)}
.footer{text-align:center;padding:24px 16px;color:var(--muted);font-size:12px;line-height:1.9}

@media(max-width:960px){
.g2,.g3,.g4{grid-template-columns:1fr}
.header-inner{justify-content:center;text-align:center}
.referral-editor-row{grid-template-columns:1fr 1fr}
}
@media(max-width:640px){
.form-grid.two{grid-template-columns:1fr}
.referral-editor-row{grid-template-columns:1fr}
.filters select,.filters input{width:100%;min-width:0}
.patient-filter-select{width:100%;max-width:none;field-sizing:fixed}
main{margin-top:16px}
.product-category-grid{grid-template-columns:repeat(2,1fr)}
.product-results{max-height:42vh}
}
