/* ==========================================================================
   NEEDS YOU (views/approvals/view.js) on the kit. Layout only, on kit tokens; the parts (rows, panels, tabs, chips,
   checks, the selection bar, pills, the definition list, stages, timeline, fields, buttons, empty states) are the kit's.
   Logical properties only, so Arabic mirrors. Loaded at boot: Projects' Approvals screen (the same rows), the inbox's
   Needs you link and a request's sheet (opened from HR and Projects too) use these rules outside the screen.
   ========================================================================== */
#approvalsScreen .appr-tabs{margin-block:var(--vx-sp-2) var(--vx-sp-3)}
#approvalsScreen .appr-unavailable{margin-block:0 var(--vx-sp-3)}
#approvalsScreen .appr-away,#approvalsScreen .appr-more{margin-block-start:var(--vx-sp-4)}

/* To approve: the kind chips and the order menu, the pick bar, the rows. */
#approvalsScreen .appr-filters{margin-block:0 var(--vx-sp-3)}
#approvalsScreen .appr-kind-count{font-family:var(--vx-font-fig);font-variant-numeric:tabular-nums}
#approvalsScreen .appr-order{margin-inline-start:auto}
/* A phone: when the order menu does not fit beside the kind chips it starts the next line under them, at their start
   edge, rather than alone at the far end. */
@media (max-width:719px){#approvalsScreen .appr-order{margin-inline-start:0}}
/* Select all stands in the list panel's inline padding (the kit's .vx-panel side, --vx-sp-5h), so its box is in the
   column of the rows' pick boxes under it (it was 22 before them at every width). */
.appr-bulk{margin-block:0 var(--vx-sp-3);padding-inline-start:var(--vx-sp-5h)}
.appr-bulk-all{display:inline-flex;align-items:center;gap:var(--vx-sp-2);min-block-size:var(--vx-h);font:var(--vx-fw-semibold) var(--vx-fs-7) var(--vx-font);color:var(--vx-ink);cursor:pointer}
.appr-bulk-count{font:var(--vx-fw-medium) var(--vx-fs-6) var(--vx-font);color:var(--vx-ink-3);font-variant-numeric:tabular-nums}
.appr-bulk-actions{margin-inline-start:auto}
.appr-bulk-actions[hidden]{display:none}
:is(#approvalsScreen,.appr-host) .appr-list{container:appr-list / inline-size}
:is(#approvalsScreen,.appr-host) .appr-row{flex-wrap:wrap;row-gap:var(--vx-sp-2)}
:is(#approvalsScreen,.appr-host) .appr-row>.appr-row-open{min-inline-size:min(12rem,60%);min-block-size:var(--vx-h)}
:is(#approvalsScreen,.appr-host) .appr-row :is(.appr-amount,.appr-acts,.appr-status){flex:1 0 100%;box-sizing:border-box;padding-inline-start:calc(var(--vx-row-icon-size) + var(--vx-sp-3))}
:is(#approvalsScreen,.appr-host) .appr-row:has(>.appr-pick) :is(.appr-amount,.appr-acts,.appr-status){padding-inline-start:calc(var(--vx-row-icon-size) + var(--vx-check-size) + var(--vx-sp-3) * 2)}
:is(#approvalsScreen,.appr-host) .appr-acts{display:flex;flex-wrap:wrap;gap:var(--vx-sp-2)}
:is(#approvalsScreen,.appr-host) .appr-acts:empty{display:none}
:is(#approvalsScreen,.appr-host) .appr-acts>*{flex:1 1 0;min-inline-size:0}   /* equal shares */
/* At Large text a label can outgrow its share (Send back at 360): its own width is then the least and the row wraps first */
:root[data-text-size="l"] :is(#approvalsScreen,.appr-host) .appr-acts>*{min-inline-size:auto}
/* Decline asks under the request's buttons, on a line of its own (confirmInline), at every width. Beside the words on a
   wide list the buttons' box is as wide as its longest line (its buttons, or the question's Cancel and Decline), not as
   wide as all of them in one line, so it never runs past the row's end. */
:is(#approvalsScreen,.appr-host) .appr-acts>.confirm-row{flex:1 1 100%;min-inline-size:0;inline-size:min-content}
:is(#approvalsScreen,.appr-host) .appr-amount{font:var(--vx-fw-semibold) var(--vx-fs-7) var(--vx-font);color:var(--vx-ink);font-variant-numeric:tabular-nums;white-space:nowrap;unicode-bidi:isolate}
:is(#approvalsScreen,.appr-host) .appr-status{margin:0;font:var(--vx-fw-regular) var(--vx-fs-6)/1.4 var(--vx-font);color:var(--vx-ink-3)}
:is(#approvalsScreen,.appr-host) .appr-status:empty{display:none}
:is(#approvalsScreen,.appr-host) .appr-row[data-state="error"] .appr-status{color:var(--vx-danger-text)}
:is(#approvalsScreen,.appr-host) .appr-row[data-state="done"]>:not(.appr-status){opacity:.6}
:is(#approvalsScreen,.appr-host) .appr-row[data-state="done"] .appr-acts{display:none}
:is(#approvalsScreen,.appr-host) .appr-row[data-state="acting"]{cursor:progress}
:is(#approvalsScreen,.appr-host) .appr-age-line{display:block;margin-block-start:var(--vx-sp-1)}
/* A row's name in the other script than the page's (an English title in the Arabic list) keeps its own direction (the
   kit's plaintext) and is only as wide as its words, at most the row's text, so it starts on the row's start edge with
   the other names instead of against the amount or the buttons (as agent tools). */
:is(#approvalsScreen,.appr-host) :is(.appr-row,.appr-del-row)>:is(.appr-row-open,span)>b{inline-size:fit-content;max-inline-size:100%}
/* A narrow list (a phone): a row's state pill (My requests) goes under the words, on their start edge as the amount and
   the buttons are, not under the icon; the words take the whole first line so the pill always starts the next one. */
:is(#approvalsScreen,.appr-host) .appr-row:has(>.appr-state)>.appr-row-open{flex-basis:calc(100% - var(--vx-row-icon-size) - var(--vx-sp-3))}
:is(#approvalsScreen,.appr-host) .appr-row>.appr-state{margin-inline-start:calc(var(--vx-row-icon-size) + var(--vx-sp-3))}
/* From a list 480 wide (a tablet, a laptop beside the agent box, a desktop) the amount and the buttons follow the words
   on the row's line and wrap only when they do not fit there (they ran 10 to 15 past the row's end between 560 and 600
   when they could not); the buttons keep their own widths and stand at the row's end edge, on the next line when they
   wrap, never stretched across it. */
@container appr-list (width >= 480px){
  :is(#approvalsScreen,.appr-host) .appr-row :is(.appr-amount,.appr-acts){flex:none;padding-inline-start:0}
  :is(#approvalsScreen,.appr-host) .appr-row:has(>.appr-pick) :is(.appr-amount,.appr-acts){padding-inline-start:0}
  :is(#approvalsScreen,.appr-host) .appr-acts{max-inline-size:100%;margin-inline-start:auto;justify-content:flex-end}
  :is(#approvalsScreen,.appr-host) .appr-acts>*{flex:none}
  :is(#approvalsScreen,.appr-host) .appr-acts>.confirm-row{flex:none;inline-size:max-content;max-inline-size:100%;justify-content:flex-end}
  :is(#approvalsScreen,.appr-host) .appr-row :is(.appr-status,.appr-status:empty){flex:none;max-inline-size:16rem;padding-inline-start:0;text-align:end}
  :is(#approvalsScreen,.appr-host) .appr-row:has(>.appr-pick) .appr-status{padding-inline-start:0}
  :is(#approvalsScreen,.appr-host) .appr-row:is([data-state="done"],:has(>.appr-acts:empty)) .appr-status{margin-inline-start:auto}
  :is(#approvalsScreen,.appr-host) .appr-row[data-state="error"] .appr-status{flex:1 0 100%;max-inline-size:none}
  :is(#approvalsScreen,.appr-host) .appr-row:has(>.appr-state)>.appr-row-open{flex-basis:0}
  :is(#approvalsScreen,.appr-host) .appr-row>.appr-state{margin-inline-start:0}
  /* To approve: one action column. Every button at least the width of the longest word set (Approve), and the column two
     of them wide, ending at the row's end, so the buttons of every row start and end on the same lines and the amounts
     end on one line before them (D22: the order stays). */
  #approvalsList .appr-acts>button{min-inline-size:calc(var(--vx-sp-9) * 3)}
  #approvalsList .appr-acts{min-inline-size:calc(var(--vx-sp-9) * 6 + var(--vx-sp-2))}
  /* While Decline asks "Decline this?", the question and its two buttons take a line of their own at the row's end on
     one line, not the two-button column (squeezed there, they stacked three high and the row's tick left its words). */
  :is(#approvalsScreen,.appr-host) .appr-acts:has(>.confirm-row){flex:1 0 100%;min-inline-size:0;justify-content:flex-end}
}
:is(#approvalsScreen,.appr-host) .appr-chev{display:grid;place-items:center;flex:none;color:var(--vx-ink-3)}
:is(#approvalsScreen,.appr-host) .appr-chev .icon:dir(rtl){transform:scaleX(-1)}
:is(#approvalsScreen,.appr-host) .appr-row-btn{flex:none}

/* The row's opener is a plain button (the row's text); its focus ring the kit's. */
:is(#approvalsScreen,.appr-host) .appr-row-open{padding:0;border:0;background:none;color:inherit;font:inherit;text-align:start;cursor:pointer}
:is(#approvalsScreen,.appr-host) .appr-row-open:focus-visible{outline:2px solid var(--vx-focus);outline-offset:2px;border-radius:var(--vx-r-xs)}

/* The Needs you link of the From agents heading (A6): a kit button in that page head's end slot (the kit places it). */

/* A request's sheet. */
.appr-detail{display:grid;gap:var(--vx-sp-3)}
.appr-facts>dd{overflow-wrap:anywhere}
.appr-facts:empty{display:none}
.appr-steps>li>div{display:grid;gap:var(--vx-sp-0h);min-inline-size:0}
.appr-steps>li>div>b{font-weight:var(--vx-fw-semibold);color:var(--vx-ink)}
.appr-steps time{font:var(--vx-fw-medium) var(--vx-fs-4) var(--vx-font);color:var(--vx-ink-3)}
.appr-step-note{color:var(--vx-ink)}
.appr-detail-actions:empty{display:none}

/* Delegation and the rule form. */
.appr-away-actions{margin-block-start:var(--vx-sp-3)}
.appr-rule{display:grid;gap:var(--vx-sp-3)}
.appr-step-row{display:grid;gap:var(--vx-sp-2);grid-template-columns:repeat(auto-fit,minmax(min(100%,160px),1fr));align-items:end}
/* Remove step is the step's own quiet action at the end of its line (under its select on a phone), as wide as its
   words, not a bar across the sheet between two selects. */
.appr-step-remove{justify-self:end}
