/* R9 «مساحة عمل المسير» -- the ONE payroll workspace. Builds on the .pg-* sheet styles (design-system.css); theme tokens only, logical
   properties for RTL, light + dark through the shared tokens. */
.pgw-summary{display:flex;flex-direction:column;gap:8px;}
.pgw-periods,.pgw-counts{display:flex;flex-wrap:wrap;gap:8px;align-items:center;}
.pgw-chip{display:inline-flex;gap:6px;align-items:center;padding:4px 10px;border-radius:999px;border:1px solid var(--border-hairline,var(--ds-border));background:var(--surface-1,#fff);color:var(--text-secondary,var(--ds-text-muted));font-size:12.5px;}
.pgw-chip b{color:var(--text-primary,var(--ds-text));font-weight:700;}
.pgw-chip.is-warn{border-color:color-mix(in srgb,#d9902a 45%,transparent);background:color-mix(in srgb,#d9902a 10%,var(--surface-1,#fff));}
.pgw-save{margin-inline-start:auto;}
.pgw-count{display:inline-flex;gap:6px;align-items:center;min-block-size:34px;padding:4px 12px;border-radius:10px;border:1px solid var(--border-hairline,var(--ds-border));background:var(--surface-1,#fff);color:var(--text-primary,var(--ds-text));font:inherit;font-size:13px;cursor:pointer;}
.pgw-count.is-on{outline:2px solid var(--ds-primary,#1f6feb);outline-offset:1px;}
.pgw-count.is-red span{color:var(--status-critical,#d8435c);font-weight:800;}
.pgw-count.is-amber span{color:#c98a12;font-weight:800;}
.pgw-count.is-green span{color:var(--status-good,#0d9b69);font-weight:800;}
.pgw-toggle{display:inline-flex;gap:6px;align-items:center;font-size:13px;color:var(--text-secondary,var(--ds-text-muted));}
.pgw-ready{margin:0;padding:8px 12px;border-radius:10px;background:var(--surface-2,#f7fafc);color:var(--text-primary,var(--ds-text));font-size:13px;}
.pgw-ready.is-ok{background:color-mix(in srgb,#0d9b69 12%,var(--surface-1,#fff));}
.pgw-ready small{display:block;color:var(--text-muted,var(--ds-text-muted));margin-block-start:2px;}
.pgw-bulk{display:flex;flex-wrap:wrap;gap:8px;align-items:center;padding:8px 12px;border-radius:10px;background:color-mix(in srgb,var(--ds-primary,#1f6feb) 10%,var(--surface-1,#fff));border:1px solid color-mix(in srgb,var(--ds-primary,#1f6feb) 30%,transparent);}
.pgw-main{flex:1;min-block-size:0;display:flex;gap:12px;}
.pgw-grid{flex:1;min-inline-size:0;display:flex;flex-direction:column;}
.pgw-table td,.pgw-table th{block-size:38px;}
.pgw-f0,.pgw-f1,.pgw-f2,.pgw-f3,.pgw-f4{position:sticky;z-index:2;}
.pgw-f0{inset-inline-start:0;min-inline-size:40px;max-inline-size:40px;text-align:center;}
.pgw-f1{inset-inline-start:40px;min-inline-size:44px;text-align:center;}
.pgw-f2{inset-inline-start:84px;min-inline-size:44px;}
.pgw-f3{inset-inline-start:128px;min-inline-size:210px;text-align:start;white-space:normal!important;}
.pgw-f4{inset-inline-start:338px;min-inline-size:120px;box-shadow:inset -1px 0 0 var(--ds-border);}
.pgw-table thead .pgw-f0,.pgw-table thead .pgw-f1,.pgw-table thead .pgw-f2,.pgw-table thead .pgw-f3,.pgw-table thead .pgw-f4,.pgw-table tfoot th{z-index:4;}
.pgw-name{border:0;background:none;padding:0;font:inherit;font-weight:700;color:var(--text-primary,var(--ds-text));cursor:pointer;text-align:start;}
.pgw-name:hover,.pgw-name:focus-visible{text-decoration:underline;}
.pgw-f3 small{display:block;color:var(--text-muted,var(--ds-text-muted));font-weight:400;}
.pgw-tag{display:inline-block;margin-inline-start:6px;padding:0 6px;border-radius:6px;font-size:11px;font-weight:600;background:var(--surface-2,#eef3f8);color:var(--text-secondary,var(--ds-text-muted));}
.pgw-tag.is-warn{background:color-mix(in srgb,#d9902a 18%,transparent);color:#9a6400;}
.pgw-tag.is-note{background:color-mix(in srgb,var(--ds-primary,#1f6feb) 14%,transparent);}
.pgw-st{display:inline-grid;place-items:center;inline-size:24px;block-size:24px;border-radius:999px;font-weight:800;font-size:13px;}
.pgw-st.is-green{background:color-mix(in srgb,#0d9b69 18%,transparent);color:var(--status-good,#0d9b69);}
.pgw-st.is-amber{background:color-mix(in srgb,#d9902a 20%,transparent);color:#a86d00;}
.pgw-st.is-red{background:color-mix(in srgb,#d8435c 18%,transparent);color:var(--status-critical,#d8435c);}
.pgw-row.is-selected td,.pgw-row.is-selected th{background:color-mix(in srgb,var(--ds-primary,#1f6feb) 8%,var(--surface-1,#fff));}
.pgw-row.is-open td,.pgw-row.is-open th{box-shadow:inset 0 2px 0 var(--ds-primary,#1f6feb),inset 0 -2px 0 var(--ds-primary,#1f6feb);}
.pgw-grp th{position:sticky;inset-inline-start:0;text-align:start;background:var(--surface-2,#eef3f8)!important;font-weight:700;}
.pgw-grp small{color:var(--text-muted,var(--ds-text-muted));font-weight:500;margin-inline-start:8px;}
.pgw-panel{inline-size:380px;flex:none;overflow:auto;border:1px solid var(--border-hairline,var(--ds-border));border-radius:12px;background:var(--surface-1,#fff);color:var(--text-primary,var(--ds-text));padding:14px;display:flex;flex-direction:column;gap:12px;}
.pgw-panel h3{margin:0;font-size:16px;}
.pgw-panel h4{margin:0 0 6px;font-size:13.5px;color:var(--text-secondary,var(--ds-text-muted));}
.pgw-panel-head{display:flex;justify-content:space-between;align-items:flex-start;gap:8px;}
.pgw-panel-head small{color:var(--text-muted,var(--ds-text-muted));}
.pgw-st-line{padding:10px;border-radius:10px;background:var(--surface-2,#f7fafc);}
.pgw-st-line.is-red{background:color-mix(in srgb,#d8435c 10%,var(--surface-1,#fff));}
.pgw-st-line.is-green{background:color-mix(in srgb,#0d9b69 10%,var(--surface-1,#fff));}
.pgw-st-line ul{margin:6px 0 0;padding-inline-start:18px;font-size:13px;}
.pgw-net{display:flex;justify-content:space-between;align-items:baseline;flex-wrap:wrap;gap:6px;padding:10px;border-radius:10px;background:color-mix(in srgb,#0d9b69 10%,var(--surface-1,#fff));}
.pgw-net b{font-size:20px;font-variant-numeric:tabular-nums;}
.pgw-net small{inline-size:100%;color:var(--text-muted,var(--ds-text-muted));}
.pgw-lines,.pgw-msgs,.pgw-props{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:6px;}
.pgw-lines li{display:grid;grid-template-columns:1fr auto;gap:2px 8px;padding:6px 8px;border-radius:8px;background:var(--surface-2,#f7fafc);font-size:13px;}
.pgw-lines li small{grid-column:1/-1;color:var(--text-muted,var(--ds-text-muted));font-size:11.5px;overflow-wrap:anywhere;}
.pgw-lines li.is-deduction b{color:var(--status-critical,#d8435c);}
.pgw-msg{font-size:13px;padding:6px 8px;border-radius:8px;background:var(--surface-2,#f7fafc);}
.pgw-msg.is-warning{background:color-mix(in srgb,#d9902a 12%,var(--surface-1,#fff));}
.pgw-lvl{font-weight:700;font-size:11.5px;margin-inline-end:4px;color:var(--text-secondary,var(--ds-text-muted));}
.pgw-suggest{margin:6px 0 0;font-size:12.5px;color:var(--text-secondary,var(--ds-text-muted));}
.pgw-prop{display:flex;flex-wrap:wrap;justify-content:space-between;gap:6px;padding:8px;border-radius:8px;border:1px dashed color-mix(in srgb,#d9902a 55%,transparent);font-size:13px;}
.pgw-prop span{display:block;color:var(--text-muted,var(--ds-text-muted));}
.pgw-prop-act{display:flex;gap:6px;flex-wrap:wrap;}
.pgw-actions{display:flex;flex-wrap:wrap;gap:6px;}
.pgw-actions h4{inline-size:100%;}
.pgw-note{inline-size:100%;margin:4px 0 0;font-size:13px;}
.pga-ov{max-inline-size:110px;}
@media (max-width:1100px){.pgw-panel{position:fixed;inset-block:0;inset-inline-end:0;inline-size:min(420px,100vw);z-index:470;border-radius:0;box-shadow:-12px 0 32px rgba(0,0,0,.18);}}
@media (max-width:640px){.pgw-f3{min-inline-size:150px;}.pgw-f4{display:none;}.pgw-table thead tr.pg-groups th:first-child{min-inline-size:0;}.pg-tools label{flex:1 1 45%;}.pg-tools select{inline-size:100%;}.pgw-save{margin-inline-start:0;}}
@media print{.pgw-summary,.pgw-bulk,.pgw-panel,.pgw-f0,.pgw-f1,.pgw-tag{display:none!important;}}
/* theme tokens for every sheet surface (the older .pg-* rules fall back to light colours in dark mode) */
.pgw-table thead th{background:var(--surface-2,#eef3f8);}
.pgw-table tfoot td,.pgw-table tfoot th{background:var(--surface-2,#eef3f8);color:var(--text-primary,var(--ds-text));}
.pgw-table .pg-total{background:var(--surface-2,#eef3f8)!important;}
.pgw-table td,.pgw-table th{color:var(--text-primary,var(--ds-text));border-color:var(--border-hairline,var(--ds-border));}
.pgw-f3 small{display:inline;margin-inline-start:6px;}
