/* Additions to the prototype stylesheet for the real platform: forms, the unit page, the login screen. */
[hidden]{display:none!important}
.login{min-height:100vh;display:grid;place-items:center;background:var(--rail,#151617);padding:24px}
.login .box{background:var(--surface);border-top:4px solid var(--bronze);padding:28px;width:min(460px,100%);display:flex;flex-direction:column;gap:14px}
.login img{width:210px;height:auto;background:#151617;padding:12px 16px;align-self:center}
.login h1{margin:0;font-size:1.25rem;text-align:center}
.login p{margin:0;color:var(--muted);text-align:center;font-size:.92rem}
.login .ulist{display:flex;flex-direction:column;gap:6px}
.login .ulist button{display:flex;justify-content:space-between;gap:10px;padding:11px 14px;text-align:start}
.me{display:flex;gap:10px;align-items:center;flex-wrap:wrap}.me b{font-weight:600}
.frm{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:10px 14px;align-items:end}
.frm label{display:flex;flex-direction:column;gap:4px;font-size:.86rem;color:var(--muted)}
.frm .wide{grid-column:1/-1}
.frm input,.frm select,.frm textarea,.tbl td input,.tbl td select{max-width:none;width:100%;font:inherit;padding:8px 10px;border:1px solid var(--line);background:var(--surface);color:var(--ink);border-radius:0;min-height:40px}
.frm input[type=number]{width:100%}
.frm .act{display:flex;gap:8px;flex-wrap:wrap}
.kvs{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:12px 18px;margin:0}
.kvs div{display:flex;flex-direction:column;gap:2px;min-width:0}.kvs dt{font-size:.8rem;color:var(--muted)}.kvs dd{margin:0;font-weight:600;overflow-wrap:anywhere}
.panel>h3,.panel>header>h3{margin:0 0 12px}.panel>header{display:flex;justify-content:space-between;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:12px}.panel>header>h3{margin:0}
.panel details{margin-top:12px}.panel details summary{cursor:pointer;color:var(--accent);font-weight:600;padding:6px 0}
.stepl{list-style:none;margin:0;padding:0;display:flex;flex-direction:column}
.stepl li{display:grid;grid-template-columns:auto 1fr auto;gap:6px 12px;align-items:start;padding:12px 0;border-top:1px solid var(--line)}
.stepl li:first-child{border-top:0}
.stepl .sn{min-width:34px;height:28px;display:grid;place-items:center;color:#fff;font-weight:700;font-size:.8rem;background:var(--c,var(--muted))}
.stepl .sb{display:flex;flex-direction:column;gap:3px;min-width:0}.stepl .sb small{color:var(--muted)}
.stepl li.pending{opacity:.62}.stepl li.active{background:color-mix(in srgb,var(--accent) 7%,transparent);padding-inline:10px;margin-inline:-10px}
.stepl .sa{display:flex;gap:6px;flex-wrap:wrap;justify-content:flex-end}
.stepl .rj{color:var(--st-bad);font-size:.88rem}
.btn.sm{padding:4px 10px;font-size:.86rem}.btn.dng{color:var(--st-bad)}
.money{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));border:1px solid var(--line)}
.money div{padding:12px 14px;border-inline-start:1px solid var(--line);margin-inline-start:-1px;display:flex;flex-direction:column;gap:2px}
.money small{color:var(--muted)}.money b{font-size:1.2rem;font-variant-numeric:tabular-nums}
.warn{border:1px solid var(--st-res);background:color-mix(in srgb,var(--st-res) 10%,var(--surface));padding:10px 14px}
.warn ul{margin:6px 0 0;padding-inline-start:18px}
#toasts{position:fixed;inset-inline:0;bottom:18px;display:flex;flex-direction:column;align-items:center;gap:8px;z-index:50;pointer-events:none}
#toasts .t{background:#151617;color:#fff;padding:10px 18px;border-bottom:3px solid var(--bronze);max-width:min(560px,92vw);pointer-events:auto}
#toasts .t.err{border-bottom-color:#F28B82}
.tbl tr.click{cursor:pointer}.tbl tr.click:hover td{background:color-mix(in srgb,var(--accent) 6%,transparent)}
.perm td select{min-width:92px}
iframe.ed{width:100%;height:calc(100vh - 150px);border:1px solid var(--line);background:var(--surface)}
@media (max-width:640px){.stepl li{grid-template-columns:auto 1fr}.stepl .sa{grid-column:1/-1;justify-content:flex-start}}

/* overview pages */
.ftabs{border-bottom:3px solid var(--bronze);padding-bottom:10px}.ftabs .btn{font-weight:700}
.mbld{margin-bottom:14px}.mbld h4{margin:0 0 6px;font-size:.95rem}
.mrow{display:grid;grid-template-columns:92px 1fr;gap:8px;align-items:start;padding:5px 0;border-top:1px solid var(--line)}
.mfl{font-size:.82rem;color:var(--muted);padding-top:8px}
.mcells{display:flex;flex-wrap:wrap;gap:5px}
.mcell{display:flex;flex-direction:column;align-items:center;justify-content:center;min-width:74px;min-height:46px;padding:4px 8px;text-decoration:none;border:1px solid currentColor;background:color-mix(in srgb,currentColor 13%,var(--surface))}
.mcell b{color:var(--ink);font-size:.9rem}.mcell small{color:var(--ink);font-size:.68rem;opacity:.85}
.mcell:hover,.mcell:focus-visible{outline:2px solid var(--accent);outline-offset:1px}
.thb{all:unset;cursor:pointer;font-weight:600;white-space:nowrap}.thb:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.rolegrid{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:12px}
.rvt td{vertical-align:top}.rvt td.wr{white-space:normal;min-width:240px;max-width:46ch}
.rvb{display:inline-flex;gap:4px}.rvb .chip{cursor:pointer;min-width:36px;min-height:32px;justify-content:center;font:inherit;font-size:.95rem}
.rvb .chip[aria-pressed=false]{color:var(--muted)}.rvb .chip[aria-pressed=true]{box-shadow:inset 0 0 0 2px currentColor;font-weight:800;background:color-mix(in srgb,currentColor 22%,var(--surface))}
.rvb .chip:disabled{cursor:default;opacity:.7}
.rvn input{min-width:190px;width:100%;font:inherit;padding:7px 9px;border:1px solid var(--line);background:var(--surface);color:var(--ink);border-radius:0;max-width:none}
@media (max-width:640px){.mrow{grid-template-columns:1fr}.mfl{padding-top:0}}

/* ---------- usability layer (ux.js) ---------- */
.panel>header select{min-height:38px;padding:6px 10px;font:inherit;border:1px solid var(--line);background:var(--surface);color:var(--ink);border-radius:0}
.uxbar{margin:0 0 10px}.uxbar input{font:inherit;padding:8px 10px;border:1px solid var(--line);background:var(--surface);color:var(--ink);border-radius:0;min-height:40px;width:min(320px,100%)}
.uxmore{display:block;margin:10px auto 0;min-width:220px}
.jump{position:sticky;top:0;z-index:5;background:var(--bg,var(--surface));padding:8px 0;margin:-8px 0 0;display:flex;gap:6px;overflow-x:auto;scrollbar-width:none;border-bottom:1px solid var(--line)}
.jump::-webkit-scrollbar{display:none}.jump .btn{white-space:nowrap;flex:0 0 auto}
.jump .n{display:inline-grid;place-items:center;min-width:22px;height:22px;padding:0 6px;margin-inline-start:6px;background:var(--st-res);color:#fff;font-size:.78rem;font-weight:700;border-radius:11px}
/* workflow on the unit page: finished tracks fold, finished and future steps take one line */
.runx{border:1px solid var(--line);margin-bottom:10px;background:var(--surface)}
.runx>summary{display:flex;gap:10px;align-items:center;flex-wrap:wrap;padding:12px 14px;cursor:pointer;list-style:none;color:var(--ink);font-weight:400}
.runx>summary::-webkit-details-marker{display:none}
.runx>summary::before{content:'';width:8px;height:8px;border-inline-end:2px solid var(--muted);border-bottom:2px solid var(--muted);transform:rotate(45deg);transition:transform .15s;flex:0 0 auto;margin-inline-end:2px}
.runx[open]>summary::before{transform:rotate(-135deg)}
.runx>summary b{font-size:1.02rem}.runx>summary .muted{font-size:.84rem}.runx>summary .sp{flex:1}
.runx.live{border-inline-start:4px solid var(--st-res)}
.runx .stepl{padding:0 14px 6px}
.stepl li.lite{padding:7px 0;align-items:center}.stepl li.lite .sn{height:22px;min-width:28px;font-size:.72rem}.stepl li.lite .sb b{font-weight:500;font-size:.93rem}
.stepl li.lite .sb{flex-direction:row;flex-wrap:wrap;gap:2px 10px;align-items:baseline}
.stepl li.pending.lite{opacity:.55}
.stepl li.active,.stepl li.await{background:color-mix(in srgb,var(--st-res) 9%,transparent);padding:14px 10px;margin-inline:-10px;border-top:0;box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--st-res) 45%,transparent)}
.prog{flex:0 0 90px;height:6px;background:var(--line);position:relative}.prog i{position:absolute;inset-block:0;inset-inline-start:0;background:var(--st-av)}
#who .me2{display:flex;flex-direction:column;gap:8px;align-items:flex-start}#who .me2 b{color:#fff}#who .me2 .btn{background:transparent;color:#fff;border-color:rgba(255,255,255,.35)}
@media (min-width:981px){#who .me2{display:none}}
@media (max-width:980px){
  .top .me{display:none}
  .btn,.btn.sm,summary,.frm input,.frm select,.filters select,.filters input:not([type=checkbox]):not([type=file]){min-height:44px}
  .btn.sm{padding:8px 14px;font-size:.9rem}
  .panel details summary{display:flex;align-items:center}
  .mcells{display:grid;grid-template-columns:repeat(auto-fill,minmax(68px,1fr));gap:6px}.mcell{min-width:0;min-height:52px}
  .stepl .sa{grid-column:1/-1;justify-content:flex-start}.stepl .sa .btn{flex:1 1 auto}
  .jump{top:0;margin-inline:-16px;padding-inline:16px}
}
@media (max-width:640px){
  .tbl:has(table.cards){border:0;background:transparent;overflow:visible}
  table.cards,table.cards tbody,table.cards tr,table.cards td{display:block;width:100%}
  table.cards thead{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
  table.cards tr{background:var(--surface);border:1px solid var(--line);padding:10px 14px;margin-bottom:8px}
  table.cards tr[hidden]{display:none}
  table.cards td{display:flex;justify-content:space-between;align-items:baseline;gap:14px;padding:4px 0;border:0;white-space:normal;text-align:end;min-width:0;max-width:none;overflow-wrap:anywhere}
  table.cards td::before{content:attr(data-th);color:var(--muted);font-size:.82rem;font-weight:400;flex:0 0 36%;text-align:start}
  table.cards td[data-th=""]::before{content:none}table.cards td[data-th=""]{justify-content:flex-start}
  table.cards td.nil{display:none}
  table.cards td:first-child{font-weight:700;font-size:1.02rem;padding-bottom:6px;margin-bottom:4px;border-bottom:1px solid var(--line)}
  table.cards td:first-child::before{font-weight:400}
  table.cards td form.filters{justify-content:flex-end;flex:1}
  table.cards tr.click{border-inline-start:3px solid var(--bronze)}
  .tbl:has(table.wide){position:relative}.tbl:has(table.wide)::after{content:'اسحب الجدول يمينًا ويسارًا لرؤية باقي الأعمدة';display:block;position:sticky;inset-inline-start:0;padding:6px 10px;font-size:.78rem;color:var(--muted);background:var(--sunk,var(--surface))}
  .uxmore{width:100%}
}
/* second pass */
.filepick{display:inline-flex;align-items:center;gap:8px;flex-wrap:wrap;min-width:0}.filepick input[type=file]{position:absolute;width:1px;height:1px;opacity:0;pointer-events:none}.filepick span{color:var(--muted);font-size:.86rem;overflow-wrap:anywhere}
.filepick:focus-within .btn{outline:2px solid var(--accent);outline-offset:2px}
@media (max-width:980px){
  .stepl li.lite{grid-template-columns:auto 1fr auto}.stepl li.lite .sa{grid-column:auto;justify-content:flex-end}
  .stepl li.pending.lite .sa{display:none}
  .runx>summary{padding:12px 10px;gap:6px 10px}.runx>summary .prog{flex-basis:60px}.runx .stepl{padding:0 10px 6px}
}
@media (max-width:640px){
  table.cards td{flex-wrap:wrap;row-gap:6px}table.cards td>*{min-width:0;max-width:100%}
  table.cards td .chip{white-space:normal}
  .kpis .kpi b{font-size:1.25rem}
}
@media (max-width:980px){.rvb .chip{min-width:44px;min-height:44px}.tbl.big th button,.thb{min-height:44px}.top select{min-height:44px}}

.login .box p.err{background:#FDECEA;color:#8A1C12;border:1px solid #F5C2BC;border-radius:10px;padding:10px 12px;margin:0 0 12px}
