/* الخزانة: the Treasury */
.tr-figs { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.tr-fig { display: flex; flex-direction: column; gap: 4px; background: #fffdf8; border: 1px solid #e4dab8; border-radius: 10px; padding: 11px 13px; text-decoration: none; color: inherit; }
.tr-fig small { font-size: 11.5px; color: #8a8466; }
.tr-fig b { font-size: 17px; font-variant-numeric: tabular-nums; }
.tr-fig.ok b { color: #2f6b45; }
.tr-fig.bad b { color: #9b2c2c; }
.tr-alarms { list-style: none; margin: 0; padding: 8px 12px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.tr-alarms li { display: flex; justify-content: space-between; gap: 10px; padding: 5px 8px; border-radius: 7px; background: #fbf7ea; }
.tr-alarms li.bad, .tr-alarms li.high { background: #fbeeee; color: #9b2c2c; }
.tr-reps { flex-wrap: wrap; gap: 6px; }
.tr-reps .chip { text-decoration: none; padding: 4px 11px; border-radius: 99px; border: 1px solid #d8cb9f; background: #fffdf8; color: #6f6843; font-size: 12.5px; }
.tr-reps .chip.on { background: #26231f; color: #f3ecda; border-color: #26231f; }
.tr-checks { list-style: none; margin: 0; padding: 8px 14px; display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
.tr-checks li { display: flex; justify-content: space-between; gap: 10px; }
.tr-checks li.ok { color: #2f6b45; }
.tr-checks li.bad { color: #9b2c2c; }
.tr-checks li.warn { color: #8a5a20; }
.hr-lock { text-align: center; padding: 40px 20px; }
.hr-lock b { display: block; font-size: 17px; margin-bottom: 6px; }
.hr-lock p { color: #6f6843; font-size: 13px; max-width: 460px; margin: 0 auto 14px; }
.hr-lock .row { justify-content: center; }
.mono { font-variant-numeric: tabular-nums; }

/* «سجّل»: the counter where money is written down (public/js/treasury-record.js). */
.tr-acts { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr)); gap: 10px; margin-bottom: 16px; }
.tr-act { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; gap: 2px 10px; align-items: start;
  padding: 12px 13px; border: 1px solid var(--ui-line); border-radius: var(--ui-radius); background: var(--ui-card); color: inherit; text-decoration: none; }
.tr-act:hover { border-color: var(--ui-gold); background: #fffef9; }
.tr-act.on { border-color: var(--ui-ink); background: var(--ui-cream); }
.tr-act i { grid-row: 1 / 3; font-style: normal; font-size: 17px; width: 30px; height: 30px; display: grid; place-items: center;
  border-radius: 8px; background: var(--ui-bg); color: var(--ui-gold-2); }
.tr-act.on i { background: var(--ui-ink); color: var(--ui-cream); }
.tr-act b { font-size: 14px; }
.tr-act span { font-size: 11.5px; color: var(--ui-muted); line-height: 1.55; }
.tr-rec .tr-note { margin: 0 14px 4px; }
.tr-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 0 14px; padding: 12px 14px 2px; }
.tr-form .fld.wide { grid-column: 1 / -1; }
.tr-form .fld > label .req { color: var(--ui-gold-2); font-style: normal; }
.tr-form input, .tr-form select { width: 100%; }
.tr-check { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; padding-top: 6px; }
.tr-check input { width: auto; }
.tr-do { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 14px 14px; }
.tr-said { margin: 0 14px 10px; }
.tr-said a { color: inherit; }

/*
 * The Treasury's frame, as read in English first and in Arabic second (the review of 2026-10-24). Everything here is
 * held under .tr-ws, the Treasury's own workspace, so the HR workspace that shares .hrm is left as it is.
 */
/* The toolbar stands under the page's description at the start edge, in both languages: it no longer floats alone at
   the far end of the heading (English), nor jumps to the far left beside it (Arabic). */
.tr-ws .hrm-hello { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 12px; margin-bottom: 18px; }
.tr-ws .hrm-hello > .row, .tr-ws .hrm-hello > .seg { align-self: flex-start; }
.tr-ws .page-sub { margin: 0; text-wrap: pretty; }
.tr-ws .tr-lead { margin: 0 0 12px; text-wrap: pretty; }
.tr-ws .tr-name, .tr-ws .nowrap { white-space: nowrap; }
.tr-ws .tr-month { width: auto; min-width: 170px; }
/* «الخزانة» in the display face joins its lam and kha so that it read «انخزانة» at the side menu's size. */
html[dir=rtl] .tr-ws .hrm-brand b { font-family: var(--ui-font); font-weight: 700; font-size: 18px; }

/* The figures: every value on one line at the foot of its tile, an empty one a dash in the tile's own ink. */
.tr-fig { justify-content: space-between; min-height: 74px; }
.tr-fig small { line-height: 1.45; }
.tr-fig b { margin-top: auto; font-size: 19px; line-height: 1.25; white-space: nowrap; }
.tr-nil { color: var(--ui-muted); font-family: var(--ui-font); font-weight: 400; }
a.tr-fig:hover { border-color: var(--ui-gold-2); }

/* Tables: as wide as their card, money at the end of its cell under a head set the same way. */
.tr-ws .tr-scroll { overflow-x: auto; max-width: 100%; }
#view .tr-ws table.grid { display: table; width: 100%; }
.tr-ws table.grid th.n, .tr-ws table.grid td.n { text-align: end; white-space: nowrap; }
.tr-th { display: none; }
.tr-acts-c { display: inline-flex; flex-wrap: wrap; gap: 6px; }
@media (min-width: 761px) { .tr-ws table.grid th { white-space: nowrap; } }
/* An empty list is one quiet line in its card, not a tall empty box. */
.tr-ws .card > .empty { padding: 18px; font-size: 14px; }
.tr-ws [class="card"] > .empty:last-child { margin-bottom: 0; }
/* A table that ends its card ends it: no blank band under its last row, and the card's rounded corners kept. */
.tr-ws [class="card"] > .tr-scroll:last-child, .tr-ws .card > .tr-scroll:last-child { margin-bottom: 0; border-bottom-left-radius: inherit; border-bottom-right-radius: inherit; }
.tr-ws .card > .tr-scroll:first-child { border-top-left-radius: inherit; border-top-right-radius: inherit; }
.tr-ws .card > .tr-scroll:last-child tbody tr:last-child td { border-bottom: 0; }
.tr-ws .tr-month { height: 34px; padding-block: 4px; font-size: 13.5px; }

/* Two-column lists of figures (the reconciliation, a statement's totals): the value close to its name, and the dotted
   line kept inside the card instead of running past its edge. */
#view .tr-ws table.kv { display: table; }
.tr-ws [class="card"] > table.kv { width: calc(100% - 36px); }
.tr-ws table.kv th { width: 15em; }
.tr-recard { padding: 16px 18px; }
.tr-recard > table.kv { width: 100%; }
.tr-recard > .tr-said { margin: 10px 0 0; }
.tr-ws .tr-recard > .tr-do, .tr-ws [class="card"] > .row.tr-do { padding: 12px 0 0; }
.tr-ws .hrm-main > .tr-do { padding-inline: 0; }
.tr-ws .tr-sum { margin: 10px 0 0; }

/* The month's close: a mark for each line, the text hanging beside it, and what an unmet line waits for beside it. */
.tr-checks li:has(> i) { display: grid; grid-template-columns: 1.3em minmax(0, 1fr); gap: 0 6px; align-items: baseline; justify-content: initial; }
.tr-checks li > i { font-style: normal; font-weight: 700; text-align: center; }
.tr-chip { display: inline-block; font-size: 11.5px; line-height: 1.6; padding: 0 8px; border-radius: 99px; background: rgba(20, 18, 16, .05); margin-inline-start: 4px; white-space: nowrap; }
.tr-checks li.bad .tr-chip { background: var(--ui-bad-bg, #f6e3df); }
.tr-checks li.warn .tr-chip { background: var(--ui-warn-bg, #f6ecd8); }
.tr-ws .tr-date input { max-width: 220px; }

/* The Treasury's rules: cards apart, every field of a row on one line whatever its label, checkboxes level with the
   fields, the withholding table inside the card's margin and only as wide as it needs. */
.tr-rules { display: grid; gap: 18px; }
@supports (grid-template-rows: subgrid) {
  .tr-form > .fld { display: grid; grid-row: span 3; grid-template-rows: subgrid; row-gap: 5px; align-content: start; }
  .tr-form > .fld > label:not(.tr-check) { align-self: end; }
  .tr-form > .fld > .tr-check { grid-row: 2; align-self: center; min-height: 40px; padding-top: 0; }
  .tr-form > .fld > .hint { grid-row: 3; }
}
.tr-ws input[type=checkbox], #modal .tr-check input[type=checkbox] { accent-color: var(--ui-ink); width: 16px; height: 16px; flex: none; }
.tr-wht { padding: 0 18px; }
.tr-wht .tr-scroll { max-width: 520px; border: 1px solid var(--ui-line); border-radius: 10px; }
.tr-whtt input[type=text] { width: 90px; }
.tr-whtn { color: var(--ui-ink-2); margin-inline-start: 6px; }
.tr-ws .card-h .tr-ch { overflow-wrap: normal; word-break: normal; }
.tr-save { gap: 14px; }
/* On the Arabic screen a figure typed left to right still sits at the start of its field, by its label. */
html[dir=rtl] .tr-ws input[dir=ltr], html[dir=rtl] #modal .tr-form input[dir=ltr] { text-align: right; }

/* The counter's cards: the text starts under its title the same way in every card. The form's heading takes the
   card's margin (the card's «why» is already in the chosen card above it). */
.tr-act { align-content: start; }
.tr-rec > .card-h { padding: 16px 14px 0; margin-bottom: 0; }
.tr-rec > .tr-said, .tr-rec > p.small { margin-inline: 14px; }

/*
 * The side menu on a narrower screen: one dark row («Treasury · Dues ▾») that opens into an even grid of two equal
 * columns, the pattern of the People and Work sections (hr-reports.css, stores.css), drawn here for this menu so it
 * holds whatever those files do. It replaces thirteen links wrapped into a ragged block above the page.
 */
.hrm-side.tr-side .hrm-tog { display: none; }
@media (max-width: 1000px) {
  .hrm > .hrm-side.tr-side { display: block; padding: 0; border-radius: 12px; }
  .hrm > .hrm-side.tr-side .hrm-tog { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 16px; background: none; border: 0; color: #f6f1e3; font: inherit; font-size: 14px; cursor: pointer; text-align: start; }
  .hrm-side.tr-side .hrm-tog .hrm-tog-s { color: var(--ui-gold); font-size: 12px; letter-spacing: .04em; flex: none; }
  .hrm-side.tr-side .hrm-tog b { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .hrm-side.tr-side .hrm-tog i { font-style: normal; color: var(--ui-gold); transition: transform .15s; flex: none; }
  .hrm > .hrm-side.tr-side.open .hrm-tog i { transform: rotate(180deg); }
  .hrm > .hrm-side.tr-side .hrm-brand, .hrm > .hrm-side.tr-side .hrm-g { display: none; }
  .hrm > .hrm-side.tr-side.open { padding-bottom: 10px; }
  .hrm > .hrm-side.tr-side.open .hrm-g { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 4px; padding: 0 8px; margin: 0; }
  .hrm > .hrm-side.tr-side.open .hrm-l { font-size: 13px; padding: 8px; min-width: 0; line-height: 1.3; }
}

/* A phone: a table of more than three columns is a card for each row, every value under its own name. */
@media (max-width: 760px) {
  .tr-ws .hrm-hello > .row { align-self: stretch; }
  /* Once a kind of money is chosen, the seven kinds fold to their names, two to a row, and the form follows at once. */
  .tr-acts:has(> .tr-act.on) { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
  .tr-acts:has(> .tr-act.on) .tr-act { padding: 9px 10px; align-items: center; }
  .tr-acts:has(> .tr-act.on) .tr-act span { display: none; }
  .tr-acts:has(> .tr-act.on) .tr-act i { grid-row: auto; width: 26px; height: 26px; font-size: 14px; }
  .tr-acts:has(> .tr-act.on) .tr-act b { font-size: 13px; line-height: 1.3; }
  .tr-ws .hrm-hello > .row > select { flex: 1 1 auto; }
  .tr-ws .hrm-hello > .row > .btn, .tr-ws .tr-do > .btn { flex: 0 0 auto; }
  .tr-ws .tr-date input { max-width: none; }
  .tr-ws .hrm-hello > .tr-reps { flex-wrap: wrap; }
  .tr-ws .tr-reps .chip { flex: none; white-space: nowrap; }
  .tr-ws .card-h .tr-cn { flex-basis: 100%; }
  .tr-ws .card-h .grow { display: none; }
  #view .tr-ws table.tr-stack, #view .tr-ws table.tr-stack tbody, #view .tr-ws table.tr-stack tr { display: block; width: 100%; }
  #view .tr-ws table.tr-stack thead { display: none; }
  #view .tr-ws table.tr-stack tr { padding: 10px 14px; border-bottom: 1px solid var(--ui-line); }
  #view .tr-ws table.tr-stack tr:last-child { border-bottom: 0; }
  #view .tr-ws table.tr-stack td { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 3px 0; border: 0; text-align: start; white-space: normal; }
  #view .tr-ws table.tr-stack td:first-child { display: block; font-weight: 600; font-size: 14px; padding-bottom: 6px; }
  #view .tr-ws table.tr-stack td:first-child .small { font-weight: 400; }
  #view .tr-ws table.tr-stack td:not(:first-child):not(:has(> .tr-th)) { justify-content: flex-start; flex-wrap: wrap; padding-top: 8px; }
  #view .tr-ws table.tr-stack td.e { display: none; }
  .tr-ws table.tr-stack .tr-th { display: block; flex: none; max-width: 48%; color: var(--ui-muted); font-size: 12px; }
  .tr-ws table.tr-stack .tr-tv { min-width: 0; text-align: end; overflow-wrap: anywhere; }
  .tr-ws table.kv th { width: 48%; }
}

/* The review of 2026-10-24, second pass. */
/* The note under the board's description keeps the description's measure. */
.tr-ws .tr-lead { max-width: 760px; }
/* The month chooser is a pill like the buttons beside it, and they stand at its height. */
.tr-ws .tr-month { border-radius: 999px; padding-inline: 14px 10px; }
.tr-ws .hrm-hello > .row:has(> .tr-month) > .btn { min-height: 34px; display: inline-flex; align-items: center; }
/* An IBAN in groups of four, kept on one line where there is room. */
@media (min-width: 761px) { .tr-ws .tr-iban { white-space: nowrap; } }
/* The record's cards draw the side menu's line icons. */
.tr-act i .menu-ic { width: 18px; height: 18px; display: block; }
/* Two checkboxes in one field: the first level with the fields, the second under it. */
.tr-check input { margin: 0; }
@supports (grid-template-rows: subgrid) {
  .tr-form > .fld.tr-chks > .tr-check + .tr-check { grid-row: 3; min-height: 0; align-self: start; padding-top: 2px; }
}
/* A kind of withholding: its name hangs beside its code when it wraps, never back under the code. */
.tr-whtk { display: inline-flex; align-items: baseline; }
/* What an unmet line waits for wraps on a phone rather than running past the card's edge. */
@media (max-width: 760px) { .tr-chip { white-space: normal; border-radius: 10px; } }

/* The review of 2026-10-24, third pass. */
/* A sum is set in the screen's own face with even figures, in a table as on a tile: Courier set «ج.م» with a Latin
   full stop that read as a zero («ج٠م») and opened a wide gap after the minus. */
.tr-amt { font-family: var(--ui-font); font-variant-numeric: tabular-nums; letter-spacing: 0; white-space: nowrap; }
.tr-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
/* The trial balance: each level indented under its group, a group's row (the sum of those under it) in bold, and the
   totals under a rule of their own. */
.tr-trial .tr-acc { display: inline-block; }
.tr-trial .tr-d1 { padding-inline-start: 1.25em; }
.tr-trial .tr-d2 { padding-inline-start: 2.5em; }
.tr-trial .tr-d3 { padding-inline-start: 3.75em; }
.tr-trial .tr-d4 { padding-inline-start: 5em; }
.tr-trial tr.tr-grp td { font-weight: 600; }
.tr-trial tr.tr-grp td .tr-amt { font-weight: 600; }
.tr-ws table.tr-trial tfoot td { font-weight: 700; border-top: 2px solid var(--ui-ink); border-bottom: 0; padding-top: 10px; padding-bottom: 10px; }
.tr-ws table.tr-trial tfoot td .tr-amt { font-weight: 700; }
.tr-ws .card > .tr-scroll:last-child table.tr-trial tbody tr:last-child td { border-bottom: 1px solid var(--ui-line); }
/* «الخزانة» in a heading: without the lam-kha ligature that made it read «انخزانة» in Amiri (treasury.js TK). */
.tr-khz { font-feature-settings: 'rlig' 0; }
@media (max-width: 760px) {
  /* Three buttons or more stand one under another at the toolbar's width, in both languages, never two and one. */
  .tr-ws .hrm-hello > .row:has(> .btn ~ .btn ~ .btn):not(:has(> select)) { flex-direction: column; align-items: stretch; flex-wrap: nowrap; gap: 8px; }
  .tr-ws .hrm-hello > .row:has(> .btn ~ .btn ~ .btn):not(:has(> select)) > .btn { flex: none; width: 100%; justify-content: center; text-align: center; }
  /* What an unmet check waits for: a plain line of its own under the check, where its words start, not a pill that
     wrapped into a two-line blob. */
  .tr-checks li > span > .tr-chip, .tr-checks li.bad > span > .tr-chip, .tr-checks li.warn > span > .tr-chip { display: block; margin: 3px 0 0; padding: 0; background: none; border-radius: 0; font-size: 12px; line-height: 1.5; opacity: .9; }
}
