/* ═══════════════════════════════════════════════════════════════════════════
   كراده 52 — the staff sections

   Three screens that are not part of the ledger the canvas draws: employee
   profiles, دليل الموظف, and the edit history. They live beside the workbook
   rather than inside it, so they are rendered by staff.js into their own host
   element instead of by the template runtime.

   Every colour here comes from tokens.css. Nothing hard-codes one, so the
   restyle and both themes carry over untouched.

   The one rule doing structural work is the first: when a staff section is
   open, the runtime's own panels are hidden by stylesheet rather than by
   setting display on them. The runtime rewrites inline styles on every
   re-render and would undo that within a keystroke; a rule with !important
   outranks the inline style it writes and survives.
   ═══════════════════════════════════════════════════════════════════════════ */

html[data-staff] main > :not(.js-staff) { display: none !important; }
.js-staff { display: none; }
html[data-staff] .js-staff { display: block; }

/* ── the tabs ──────────────────────────────────────────────────────────────
   Matched to the canvas's own tab buttons so the row reads as one strip. The
   shape is copied deliberately rather than shared: the canvas writes those
   inline and re-renders them, and reaching into that is what breaks. */
.js-stafftab {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 500;
  padding: 9px 13px;
  white-space: nowrap;
  margin-bottom: -1px;
  cursor: pointer;
  font-family: inherit;
}
.js-stafftab:hover { color: var(--ink); }
.js-stafftab[aria-selected="true"] {
  border-bottom-color: var(--accent);
  color: var(--ink);
  font-weight: 700;
}

/* ── layout ────────────────────────────────────────────────────────────────*/
.st-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.st-title { font-size: 17px; font-weight: 700; color: var(--ink); margin: 0; }
.st-sub { font-size: 12.5px; color: var(--ink-3); margin: 3px 0 0; }

.st-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
  gap: 12px;
}

.st-card {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
  padding: 14px;
  text-align: start;
  font-family: inherit;
  color: inherit;
  cursor: pointer;
  display: flex;
  gap: 12px;
  align-items: center;
  width: 100%;
  appearance: none;
}
.st-card:hover { border-color: var(--rule-2); }
.st-card[aria-current="true"] { border-color: var(--accent); }

/* The photo, and the fallback when there is none. A profile with no photo is
   the normal state here, not an error, so the initial is styled rather than
   left as a broken frame. */
.st-photo {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 44px;
  background: var(--panel-2);
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-3);
  overflow: hidden;
}
.st-photo--lg { width: 88px; height: 88px; flex-basis: 88px; font-size: 28px; }

.st-name { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.st-meta { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }

/* ── forms ─────────────────────────────────────────────────────────────────*/
.st-panel {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
  padding: 18px;
  margin-bottom: 14px;
}
.st-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
  gap: 12px 14px;
}
.st-field { display: flex; flex-direction: column; gap: 5px; }
.st-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--ink-4);
}
.st-input,
.st-select {
  height: 32px;
  padding: 0 9px;
  font-size: 13px;
  font-family: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: var(--r-control);
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  text-align: start;
}
.st-input:focus,
.st-select:focus { outline: none; border-color: var(--accent); }
.st-input[readonly] { color: var(--ink-2); background: var(--panel-2); }
textarea.st-input { height: auto; min-height: 76px; padding: 8px 9px; resize: vertical; }

/* Phone and money read left-to-right even in an RTL page. */
.st-ltr { direction: ltr; text-align: start; font-variant-numeric: tabular-nums; }

.st-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.st-btn {
  appearance: none;
  height: 32px;
  padding: 0 14px;
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--r-control);
  border: 1px solid var(--rule);
  background: var(--panel-2);
  color: var(--ink);
  cursor: pointer;
}
.st-btn:hover { border-color: var(--rule-2); }
.st-btn--go { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.st-btn--go:hover { filter: brightness(1.08); }
.st-btn:disabled { opacity: .5; cursor: default; }

/* ── the visibility grid ───────────────────────────────────────────────────*/
.st-checks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.st-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-chip);
  padding: 5px 10px;
  cursor: pointer;
}
.st-check input { accent-color: var(--accent); margin: 0; }

/* ── checklist items ───────────────────────────────────────────────────────
   One row per item: the tick and its text on one line, the reason underneath
   when it is not done. The row is the hit area, not just the little box —
   these get tapped on a phone, mid-shift, one-handed. */
.st-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 9px 0;
  border-top: 1px solid var(--rule);
}
.st-item:first-of-type { border-top: 0; }

.st-tick {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-2);
}
.st-tick input {
  accent-color: var(--accent);
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  flex: 0 0 18px;
  cursor: pointer;
}
.st-tick input:checked + .st-itemtext {
  color: var(--ink-4);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}
.st-itemtext { flex: 1 1 auto; }

/* The reference number reads left-to-right inside an RTL line. */
.st-itemtext::first-line { font-variant-numeric: tabular-nums; }

/* width:auto, not the 100% every other .st-input carries.
   The row is a flex column, so a child with no width of its own stretches to
   what is left after the margin. With width:100% the margin was added on top
   of a full-width box and the field ran past the edge of the card. */
.st-why {
  width: auto;
  margin-inline-start: 28px;
  max-width: 420px;
}
.st-item .st-meta { margin-inline-start: 28px; }

/* A reason belongs to the exception, not to every line. On the supervisor's
   own sheet that is 156 items, and a box under each one turns a checklist into
   half an hour of scrolling. Asked for by tapping, and shown from the start
   only where one has already been written. */
.st-whyadd {
  align-self: flex-start;
  margin-inline-start: 28px;
  appearance: none;
  background: none;
  border: 0;
  padding: 2px 0;
  font: inherit;
  font-size: 11.5px;
  color: var(--ink-4);
  text-decoration: underline;
  cursor: pointer;
}
.st-whyadd:hover { color: var(--accent); }

.st-item.is-saving { opacity: .55; }
.st-item.is-failed { border-inline-start: 2px solid var(--neg); padding-inline-start: 8px; }

/* ── the three running totals ──────────────────────────────────────────────
   Figures the supervisor reads against each other, so they are laid out as one
   row and share a baseline. Tabular figures matter here more than anywhere:
   these are compared by eye, column against column. */
.st-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
}
.st-stat { display: flex; flex-direction: column; gap: 3px; }
.st-statnum {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  direction: ltr;
  text-align: right;      /* under its label, as .st-num */
  color: var(--ink);
}
/* The workbook's own summary figures (اليومية and الشهر: إجمالي المبيعات,
   النقدية, المصروفات…) are written by the generated template as
   `direction:ltr;text-align:start` — the LEFT under ltr, while each label sits
   on the right. The template is not hand-edited, so the two are matched here
   and pinned to the right, under their labels. */
div[style*="direction:ltr;text-align:start;margin-top:3px"],
div[style*="direction: ltr; text-align: start; margin-top: 3px"] { text-align: right !important; }
/* A date or words in a stat's place: read right to left, not as a figure. */
.st-statnum--text { direction: rtl; font-family: inherit; }

/* Armed state of a two-step delete. Not a separate colour token — it borrows
   the negative one already defined for amounts. */
.st-btn--warn {
  border-color: var(--neg);
  color: var(--neg);
  font-weight: 700;
}

/* ── the three derived payroll columns ─────────────────────────────────────
   البونص، الخصم، السلف are the sum of their records now, maintained by a
   database trigger. The canvas still draws them as editable inputs, so they
   are made to read as figures rather than fields: no underline to type on,
   and a cursor that does not invite it.

   Deliberately not greyed out. They are real, current numbers — dimming them
   would say "empty" when what is meant is "computed elsewhere". */
input.js-pay-derived {
  border-bottom-color: transparent !important;
  cursor: default;
  color: var(--ink-2);
}
input.js-pay-derived:hover {
  border-bottom-color: var(--rule) !important;
}

/* ── tables ────────────────────────────────────────────────────────────────*/
.st-scroll { overflow-x: auto; }
.st-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.st-table th {
  text-align: start;
  font-size: 10.5px;
  letter-spacing: .07em;
  color: var(--ink-4);
  font-weight: 700;
  padding: 0 10px 7px;
  white-space: nowrap;
}
.st-table td {
  padding: 8px 10px;
  border-top: 1px solid var(--rule);
  color: var(--ink-2);
  white-space: nowrap;
}
/* `direction: ltr` keeps a figure reading left-to-right inside an RTL page,
   but it also flips what `start` means — so a numeric cell aligned to `start`
   lands on the LEFT while its heading, still in the page's RTL flow, sits on
   the right. The column then reads as two ragged edges. Both ends are pinned
   to the right here, which is also where digits want to align: place value
   lines up column against column. */
.st-num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  direction: ltr;
  text-align: right;
}
.st-table th { text-align: right; }
.st-table th:first-child, .st-table td:first-child { text-align: start; }

.st-note { font-size: 12.5px; color: var(--ink-3); }
.st-empty {
  padding: 34px 18px;
  text-align: center;
  color: var(--ink-3);
  font-size: 13px;
  border: 1px dashed var(--rule);
  border-radius: var(--r-card);
}
.st-err {
  font-size: 12.5px;
  color: var(--neg);
  margin-top: 8px;
}
.st-body { font-size: 13.5px; line-height: 1.75; color: var(--ink-2); white-space: pre-wrap; }
.st-frame {
  width: 100%;
  height: 72vh;
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
  background: var(--panel-2);
}

/* ── opening a stored file ─────────────────────────────────────────────────
   On a phone this replaces the frame entirely; on a desktop it sits under it
   as a plain link. Sized as a target rather than a line of text, because on a
   phone it is the only way into the document. */
.st-open {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--ink);
  background: var(--panel-2);
  border: 1px solid var(--rule-2);
  border-radius: var(--r-card);
  padding: 16px 18px;
  min-height: 56px;
}
.st-open:hover { border-color: var(--accent); }
.st-openicon { font-size: 22px; line-height: 1; }
.st-openmain { display: block; font-size: 14px; font-weight: 600; }
.st-opensub {
  display: block;
  font-size: 11.5px;
  color: var(--ink-3);
  margin-top: 2px;
  direction: ltr;
  text-align: start;
}
.st-open--inline {
  display: inline-flex;
  min-height: 0;
  padding: 8px 14px;
  margin-top: 10px;
  background: none;
}
.st-open--inline .st-openmain { font-size: 12.5px; font-weight: 600; }

.st-shot {
  max-width: 100%;
  border-radius: var(--r-card);
  display: block;
  margin-bottom: 12px;
}

/* ── phones ────────────────────────────────────────────────────────────────
   These screens are used standing up, one-handed, mid-shift. The changes are
   mostly about the size of what has to be hit and how much of the width the
   content is allowed to keep. */
@media (max-width: 720px) {
  .st-frame { height: 60vh; }

  /* <main>'s own padding drops at this width; the stand-in matches it. */
  .js-staffroot { padding: 16px 14px 0; }

  .st-panel { padding: 14px 13px; border-radius: var(--r-control); }

  /* The date and the shift are one decision, and they were being pushed onto
     two lines with the title between them. */
  .st-head { flex-direction: column; align-items: stretch; gap: 12px; }
  .st-head .st-row { gap: 10px; }
  .st-head .st-field { flex: 1 1 0; min-width: 120px; }
  .st-head > .st-btn, .st-head > .me-ro { align-self: flex-start; }

  /* ── checklist items ─────────────────────────────────────────────────────
     The row is the target, not the 18px box inside it. A miss on a phone is
     not a small annoyance here: it ticks the wrong task, or nothing, and the
     person has to work out which. */
  .st-item { padding: 4px 0; border-top: 0; }
  .st-tick {
    gap: 14px;
    padding: 12px 10px;
    margin: 0 -10px;
    border-radius: var(--r-control);
    font-size: 15px;
    line-height: 1.5;
    align-items: center;
  }
  .st-tick:active { background: var(--panel-2); }
  .st-tick input {
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
    margin: 0;
  }
  /* A tapped row should look tapped before the write comes back. */
  .st-tick input:checked + .st-itemtext { opacity: .6; }

  .st-why {
    width: auto;
    margin-inline-start: 40px;
    max-width: none;
    height: 40px;
    font-size: 16px;   /* below 16px Safari zooms the page on focus */
  }
  .st-whyadd { margin-inline-start: 40px; padding: 8px 0; font-size: 12.5px; }
  .st-item .st-meta { margin-inline-start: 40px; }

  /* ── anything tappable ───────────────────────────────────────────────────
     44px is the smallest target that can be hit reliably with a thumb. */
  .st-btn { height: 44px; padding: 0 18px; font-size: 13.5px; }
  .st-input, .st-select { height: 44px; font-size: 16px; }
  textarea.st-input { font-size: 16px; }
  .st-check { padding: 9px 12px; }
  .st-check input { width: 22px; height: 22px; }
  .st-undo { font-size: 18px; padding: 6px; }

  /* One card per row: two 260px columns do not fit, and a half-width card of
     wrapped Arabic is harder to scan than a full-width one. */
  .st-grid { grid-template-columns: 1fr; gap: 10px; }
  .st-fields { grid-template-columns: 1fr; }

  .st-photo--lg { width: 64px; height: 64px; flex-basis: 64px; font-size: 22px; }

  /* Tables keep their own scroll, with the edge shown so it is clear there is
     more to the side rather than the row simply ending. */
  .st-scroll {
    margin-inline: -13px;
    padding-inline: 13px;
    -webkit-overflow-scrolling: touch;
  }
  .st-table { font-size: 13px; }
  .st-table td, .st-table th { padding-inline: 8px; }

  /* The running totals read as a row of three on a desktop; stacked they
     become three lines of label-over-figure, which is the same information in
     the space available. */
  .st-stats { gap: 12px 20px; }
  .st-statnum { font-size: 16px; }

  /* The picker fills the screen rather than floating in the middle of it. */
  .st-overlay { padding: 0; place-items: stretch; }
  .st-sheet {
    width: 100%;
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 0;
    border: 0;
    padding: 16px 14px 24px;
  }
  .st-sheethead { position: sticky; top: -16px; background: var(--panel); padding: 6px 0; z-index: 1; }
  .st-pickrow { gap: 10px; }
  .st-pickamt { width: 108px; flex: 0 0 108px; }
  .st-sheetfoot {
    position: sticky;
    bottom: 0;
    background: var(--panel);
    padding-bottom: 6px;
  }
}

/* Small phones: the permissions matrix is the one thing here with more columns
   than a 360px screen can hold, so it gives up its padding first. */
@media (max-width: 420px) {
  .st-perm td, .st-perm th { padding-inline: 5px; font-size: 12px; }
  .st-open { padding: 14px; }
}

/* ── when the workbook itself is not granted ───────────────────────────────
   The runtime's own five tabs, the period picker and the running balance all
   describe a ledger this person cannot open — the restrictive policies in
   009-screen-permissions.sql see to that. Hidden by stylesheet rather than by
   setting display on them, because the runtime rewrites inline styles on every
   re-render and would undo it within a keystroke. */
html[data-no-ledger] .js-tabstrip > button:not([data-staff-tab]) { display: none !important; }

/* The period picker and the running balance beside it.
   Matched on containing the picker, NOT on being the last child: mobile-nav.js
   appends its backdrop to this row, so `:last-child` was the invisible veil and
   the picker stayed — an empty month box on an account with no periods to pick
   from. */
html[data-no-ledger] .js-navrow > div:has(select) { display: none !important; }
html[data-no-ledger] .js-period, html[data-no-ledger] .js-ticker { display: none !important; }

/* And the export button, which would hand them an empty workbook. */
html[data-no-ledger] .js-export { display: none !important; }


/* ── one lit tab at a time ─────────────────────────────────────────────────
   The workbook's tabs get their accent from an inline style the runtime
   writes, and the runtime still considers one of them current while a staff
   section is open — so both lit up at once. Dimming them here rather than
   reaching into the runtime's state: a stylesheet rule with !important
   outranks the inline style, and survives the re-render that would undo any
   attribute we set ourselves. */
html[data-staff] .js-tabstrip > button:not([data-staff-tab]) {
  border-bottom-color: transparent !important;
  color: var(--ink-3) !important;
  font-weight: 500 !important;
}
html[data-staff] .js-tabstrip > button:not([data-staff-tab]):hover {
  color: var(--ink) !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   شؤون الموظفين

   One screen carrying what used to be three tabs, so its job is mostly to keep
   a long page legible: a fixed order of parts, one accent, and figures that
   line up column against column wherever two of them can be compared.

   Everything below borrows the tokens the workbook already uses — no new
   colours. The only emphasis this screen adds is الصافي, which is the figure
   every other one on the page exists to arrive at.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── the view switch ───────────────────────────────────────────────────────
   الطاقم / جدول الشهر. A segmented control rather than two more tabs: these
   are two shapes of one screen, and the strip above already means «somewhere
   else». */
.st-seg {
  display: inline-flex;
  padding: 2px;
  gap: 2px;
  background: var(--panel-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-control);
}
.st-segbtn {
  appearance: none;
  border: 0;
  background: none;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-3);
  padding: 6px 15px;
  border-radius: calc(var(--r-control) - 1px);
  cursor: pointer;
  white-space: nowrap;
}
.st-segbtn:hover { color: var(--ink); }
.st-segbtn[aria-selected="true"] {
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .12);
}

/* ── the month in one line ─────────────────────────────────────────────────
   The same six figures the workbook's payroll hero shows, read from the same
   payrollTotals(). Laid out as cells divided by rules rather than as cards:
   they are one statement about one month, not six things. */
.st-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
  overflow: hidden;
  margin-bottom: 18px;
}
.st-sumcell {
  padding: 13px 16px 14px;
  border-inline-start: 1px solid var(--rule);
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.st-sumcell:first-child { border-inline-start: 0; }
.st-sumnum {
  font-family: var(--mono);
  font-size: 19px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  direction: ltr;
  /* Right, under its label: `start` under direction: ltr is the LEFT, and
     the cell read as two ragged edges (see .st-num). */
  text-align: right;
  color: var(--ink-2);
  line-height: 1.1;
}
/* الصافي is what the other five are for. */
.st-sumcell--lead { background: var(--panel-2); }
.st-sumcell--lead .st-sumnum { color: var(--ink); }

/* ── the roster ────────────────────────────────────────────────────────────*/
.st-rosterbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
}
.st-search { flex: 1 1 220px; max-width: 320px; }
.st-newname { flex: 0 1 200px; }

.st-roster {
  display: grid;
  /* min(…, 100%): a column never wider than the screen it is on. A fixed
     320px minimum overflowed any phone narrower than that plus the margins. */
  grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
  gap: 10px;
}

/* A card says three things at once — who, what they do, and what they are
   owed — so the figure is pinned to the far end where the eye can run down a
   single column of them. */
.st-pcard { align-items: flex-start; padding: 13px 15px; }
.st-pcardmain { flex: 1 1 auto; min-width: 0; }
.st-pcardmain .st-name,
.st-pcardmain .st-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* On a phone — and more so one set to a larger text size — the name and the
   job were cut to their first few letters. They wrap there instead. */
@media (max-width: 720px) {
  .st-pcardmain .st-name,
  .st-pcardmain .st-meta {
    white-space: normal;
    overflow: visible;
    overflow-wrap: break-word;
  }
}
/* The one line on the card that is figures. Clipping it mid-number — «سلفة
   000…» — is worse than a second line: the name and the job can be recognised
   from their first few letters, an amount cannot. */
.st-pcardmain .js-sums {
  white-space: normal;
  text-overflow: clip;
  line-height: 1.5;
}
.st-pcardnum {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  padding-inline-start: 10px;
}
.st-netnum {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  direction: ltr;
  color: var(--ink);
}

/* ── the person ────────────────────────────────────────────────────────────*/
.st-personhead { padding-bottom: 16px; }
.st-personhead .st-row { align-items: center; gap: 14px; }
.st-stat--lead .st-statnum { color: var(--accent); }

/* A figure that is read but never typed: المستحق, which is the daily rate
   times the days actually worked. Shown on its own line under the four fields
   that produce it, with the arithmetic spelled out beside it — a number with
   no visible derivation is one somebody re-derives on paper. */
.st-inline {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 13px;
  border-top: 1px solid var(--rule);
}
.st-inlinenum {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  direction: ltr;
  color: var(--ink);
}
.st-inline .st-dim { font-size: 11.5px; }

/* The workbook's own cell comments, which the export writes onto Sheet2.
   Set apart from the fields above because they are a different kind of thing:
   free text the branch reads in the sheet, not a figure this app computes. */
.st-notesbox {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
}
.st-notesbox > .st-label { display: block; margin-bottom: 10px; }
.st-notesbox textarea.st-input { min-height: 54px; }

/* ── جدول الشهر ────────────────────────────────────────────────────────────
   A table this wide has to scroll, so the panel gives up its padding and lets
   the scroll region run edge to edge; a table that scrolls inside a padded box
   looks like it has been cropped. */
.st-panel--flush { padding: 0; overflow: hidden; }
.st-tablehead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 15px 18px 14px;
  border-bottom: 1px solid var(--rule);
}

.st-paytable { min-width: 1080px; font-size: 12.5px; }
.st-paytable th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--panel-2);
  padding: 9px 10px;
  border-bottom: 1px solid var(--rule-2);
}
.st-paytable td { padding: 4px 10px; vertical-align: middle; }
.st-paytable tbody tr:hover { background: var(--panel-2); }

/* Cells that are fields. Borderless until touched: a grid of thirteen boxed
   inputs per row reads as a form to fill in rather than a sheet to scan. */
.st-cell {
  height: 30px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: var(--r-control);
  padding: 0 7px;
  width: 100%;
  min-width: 0;
}
.st-cell:hover { border-color: var(--rule); }
.st-cell:focus { border-color: var(--accent); background: var(--panel); }
.st-cell--name { min-width: 130px; }
.st-cell--num { width: 96px; text-align: right; }

.st-rowacts { display: flex; align-items: center; gap: 6px; }
.st-btn--tiny { height: 26px; padding: 0 9px; font-size: 11.5px; }
.st-notemark { color: var(--accent); font-size: 12px; }

/* الصافي again — the column the row is read for. */
.st-num--lead { color: var(--ink); font-weight: 600; }

.st-paytable tfoot td {
  border-top: 1px solid var(--rule-2);
  background: var(--panel-2);
  padding: 10px;
  font-weight: 700;
  color: var(--ink-2);
}

/* ── تسجيل الخروج ──────────────────────────────────────────────────────────
   cloud-store.js puts this in the header's button row. Styled to match the
   theme and install buttons beside it rather than to stand out: signing out is
   something you do once at the end of a shift, and a button competing with
   تصدير Excel for attention would be pressed by accident.

   Not `.st-btn`: those are 44px on a phone for thumb reach, which is right
   inside a form and wrong in a header row that also has to hold a title. */
.js-signout {
  height: 34px;
  padding: 0 13px;
  border: 1px solid var(--rule);
  border-radius: var(--r-control);
  background: var(--panel);
  color: var(--ink-3);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  flex: 0 0 auto;
}
.js-signout:hover { border-color: var(--rule-2); color: var(--ink); }

@media (max-width: 720px) {
  /* The row already carries the theme toggle, تثبيت التطبيق and تصدير Excel,
     and the brand title is beside them. Shortened so all four fit on one line
     before the row has to wrap. */
  .js-signout { padding: 0 10px; font-size: 12px; }
}

/* ── the workbook's own الرواتب tab ────────────────────────────────────────
   Hidden: its table is inside شؤون الموظفين now, next to the records that say
   why البونص والخصم والسلف are what they are — which that tab could not show
   and could not be told. staff.js marks the button by label rather than by
   position, because the position is the thing that moves.

   A stylesheet rule, not a display style set on the node: the runtime rewrites
   inline styles on every re-render and would undo it within a keystroke. */
.js-tabstrip > button[data-ledger-tab="pay"] { display: none !important; }

/* ── narrow ────────────────────────────────────────────────────────────────*/
@media (max-width: 720px) {
  /* Every field on a narrow screen goes to 16px, because below that Safari
     zooms the page the moment one is focused. In a table that means the cells
     have to grow with it — at the desktop widths «1,500,000» came out as
     «1,500,00» with the last digit clipped, which on a payroll is not a
     cosmetic problem. The table scrolls sideways in its own box either way, so
     the extra width costs nothing but a longer swipe.

     Height stays under the 44px tap target used elsewhere: twenty rows of 44px
     is a screen and a half of scrolling before the totals, and a table cell is
     a slower, more deliberate tap than a button. */
  .st-paytable { min-width: 1240px; }
  .st-paytable .st-cell { height: 40px; min-width: 116px; }
  .st-cell--num { width: 132px; }
  .st-cell--name { min-width: 180px; }
  .st-paytable td { padding: 5px 8px; }

  .st-summary { grid-template-columns: repeat(2, 1fr); }
  .st-sumcell:nth-child(odd) { border-inline-start: 0; }
  .st-sumcell:nth-child(n + 3) { border-top: 1px solid var(--rule); }
  .st-sumnum { font-size: 16px; }

  .st-roster { grid-template-columns: 1fr; }
  .st-search, .st-newname { flex: 1 1 100%; max-width: none; }
  .st-seg { width: 100%; }
  .st-segbtn { flex: 1 1 50%; }

  /* The strip is the only thing on the page that has to stay one row. */
  .st-head { align-items: stretch; }
}

/* ── room between the roster and the profile below it ──────────────────────*/
.st-detail { margin-top: 22px; }

/* ── the employee picker ───────────────────────────────────────────────────
   سلف الموظفين and المكافآت أو البونص open this instead of accepting a typed
   figure. Rendered on <body>, outside <main>, so the runtime's constant
   re-rendering of the day sheet cannot tear it down mid-entry.

   Not a browser dialog: those block every event until dismissed, which would
   freeze the rest of the app behind them. */
input.js-pick { cursor: pointer; }

.st-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  padding: 18px;
}

.st-sheet {
  background: var(--panel);
  border: 1px solid var(--rule-2);
  border-radius: var(--r-card);
  padding: 18px;
  width: min(520px, 100%);
  max-height: min(78vh, 720px);
  overflow-y: auto;
  box-shadow: 0 18px 48px rgb(0 0 0 / .22);
}
.st-sheethead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.st-shifttabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 6px;
}
.st-shifttab {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 8px 14px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-3);
  cursor: pointer;
}
.st-shifttab:hover { color: var(--ink); }
.st-shifttab[aria-selected="true"] {
  border-bottom-color: var(--accent);
  color: var(--ink);
  font-weight: 700;
}

.st-pickrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.st-pickamt { width: 128px; flex: 0 0 128px; }

.st-sheetfoot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
}

/* Shown only when saving would change the figure the day already holds. */
.st-warn {
  display: block;
  font-size: 11.5px;
  color: var(--neg);
  margin-top: 3px;
  max-width: 260px;
  line-height: 1.5;
}

/* The provider's own wording, kept under a rephrased message: the Arabic says
   what to do, this is what to search for when it does not. */
.st-errraw {
  font-size: 11px;
  color: var(--ink-4);
  direction: ltr;
  text-align: start;
  margin-top: 2px;
  font-family: var(--mono);
}

/* An action that belongs inside a sentence rather than beside it. */
.st-linkbtn {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: 11.5px;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}
.st-linkbtn:disabled { opacity: .5; cursor: default; }

/* Shown when the permission list could not be loaded. The tab strip is built
   from that list, so without it what the strip shows is a guess — and a guess
   that silently disagrees with the database is worse than an error. */
.st-rulewarn {
  background: color-mix(in srgb, var(--neg) 12%, var(--panel));
  border: 1px solid var(--neg);
  border-radius: var(--r-card);
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--ink);
}

/* A root of staff.js's own, used only when the workbook is not on the page —
   <main> lives behind `<sc-if ready>` and `ready` is false with no period to
   show, which is exactly an employee whose ledger is denied. Matched to
   <main>'s own measurements so the screens sit where they always do. */
.js-staffroot {
  max-width: 1520px;
  margin: 0 auto;
  padding: 26px 24px 0;
}

/* ── the permissions grid ──────────────────────────────────────────────────
   A matrix of people against screens, so the question it answers — who can
   open what — is read off the page rather than assembled across a dozen
   selections. */
.st-perm th:not(:first-child):not(:nth-child(2)) { text-align: center; }
.st-perm td:not(:first-child):not(:nth-child(2)) { text-align: center; }
.st-perm .st-check { border: 0; padding: 0; }
.st-dim { color: var(--ink-3); }

.st-permcell {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Marks a tick that overrides the person's job title, and clears it. An
   override you cannot see is one you will not remember making. */
.st-undo {
  appearance: none;
  border: 0;
  background: none;
  padding: 0 2px;
  font-size: 13px;
  line-height: 1;
  color: var(--accent);
  cursor: pointer;
}
.st-undo:disabled { opacity: .4; cursor: default; }

/* ── a PDF drawn in the app ────────────────────────────────────────────────
   One canvas per page, stacked. Each is drawn at roughly twice the width it is
   shown at, so pinching to read small Arabic stays sharp rather than turning
   into a blur of enlarged pixels. */
.st-pdf {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
}
.st-pdfpage {
  display: block;
  width: 100%;
  height: auto;
  background: #fff;          /* a page is white in every theme */
  border: 1px solid var(--rule);
  border-radius: var(--r-control);
}
.st-pdfnum {
  font-size: 11px;
  color: var(--ink-4);
  font-variant-numeric: tabular-nums;
  direction: ltr;
  margin-top: -8px;
}

/* ── unsaved changes in the permissions grid ───────────────────────────────
   Ticks are collected and written together, so the state of the page and the
   state of the database differ for as long as it takes to decide. That gap has
   to be visible, and reachable: the bar follows the bottom of the screen
   rather than sitting below whichever table was scrolled past. */
.st-savebar { display: none; }
.st-savebar.is-on {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  position: sticky;
  bottom: 12px;
  z-index: 5;
  margin-top: 16px;
  padding: 12px 14px;
  background: var(--panel-2);
  border: 1px solid var(--accent);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-toast);
}
.st-savecount { font-size: 13px; font-weight: 600; color: var(--ink); flex: 1 1 auto; }
.st-leavewarn {
  flex: 1 1 100%;
  font-size: 12px;
  color: var(--neg);
  line-height: 1.6;
}

/* A tick that is queued but not yet written. Marked rather than left to be
   inferred from the save count, which says how many but not which. */
.st-check.is-dirty {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-radius: var(--r-chip);
}

/* A field whose fixed domain is shown beside it rather than typed into it, so
   what a username turns into is visible without anyone having to know. */
.st-suffixed {
  display: flex;
  align-items: stretch;
  direction: ltr;
  border: 1px solid var(--rule);
  border-radius: var(--r-control);
  background: var(--bg);
  overflow: hidden;
}
.st-suffixin {
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  flex: 1 1 auto;
  min-width: 0;
}
.st-suffix {
  display: flex;
  align-items: center;
  padding: 0 10px;
  font-size: 12.5px;
  color: var(--ink-3);
  background: var(--panel-2);
  white-space: nowrap;
  border-inline-start: 1px solid var(--rule);
}

/* إضافة موظف on the payroll tab added a workbook row and nothing else — no
   profile, no job title, no account. Someone joining the branch is created
   once, in ملفات الموظفين, and the payroll line follows from that. */
.js-addpay { display: none !important; }

/* Set apart from the ordinary controls, because it is not one: the pay terms
   go with the profile and the months already paid lose their link to it. */
.st-danger {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
}
.st-danger .st-note { margin-bottom: 10px; max-width: 460px; }

/* ── editing a checklist ───────────────────────────────────────────────────
   The sheets were loaded once by a migration and had no way to be corrected
   afterwards, which left every gap in them somebody else's job. A row here is
   the number, the task, and a way to remove it. */
.st-editrow {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-top: 1px solid var(--rule);
}
.st-editrow:first-of-type { border-top: 0; }
/* Wide enough for a reference covering two of the branch's numbers —
   «7.1، 12.1» on the cinema sheet, «8.5، 8.7» on the billiards one. At
   76px those scrolled inside the field while being edited. */
.st-editref { width: 96px; flex: 0 0 96px; }
.st-edittext { flex: 1 1 auto; min-width: 0; }
.st-editdel { flex: 0 0 auto; }

/* Changed, not yet written. Saved on blur, not on every keystroke — an item is
   a sentence, and typing one should not be forty requests. */
.st-editrow.is-dirty .st-edittext,
.st-editrow.is-dirty .st-editref { border-color: var(--accent); }

@media (max-width: 720px) {
  .st-editrow { flex-wrap: wrap; }
  .st-editref { width: 96px; flex: 0 0 96px; }
  .st-edittext { flex: 1 1 100%; order: 3; }
}

/* A change that arrived from the branch's Google Sheet rather than from
   this app. Tinted so a screenful of entries can be scanned for «who did
   this» without reading every row. */
.st-src--sheet { color: var(--accent); font-weight: 600; }

/* ── the tab strip scrolls sideways, never down ─────────────────────────────
   The strip carries an inline `overflow-x:auto` from the generated markup, and
   that is not the narrow instruction it looks like. When one axis is set to
   anything other than `visible`, CSS computes the OTHER axis to `auto` rather
   than leaving it visible — so overflow-y became scrollable too, and a single
   pixel of vertical overflow (a focus ring, a border, line-height rounding)
   was enough to put a vertical scrollbar beside eleven tabs that have no
   reason to scroll downwards.

   Stated explicitly here rather than fixed in index.html, which is generated
   from the canvas. The mobile drawer overrides this with !important inside its
   media query, where scrolling down IS the point — it is a full-height panel
   and the tabs genuinely do not fit.

   The horizontal bar STAYS VISIBLE. Hiding it was tried and was wrong: the
   strip still scrolled, but with a mouse there was no longer any way to reach
   the tabs past the edge — shift+wheel works and nobody discovers it. A
   scrollbar on a strip that scrolls is not clutter; it is the only thing
   saying there is more. Thin, so it reads as an affordance rather than
   furniture. */
.js-tabstrip {
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--rule) transparent;
}

.js-tabstrip::-webkit-scrollbar { height: 6px; }
.js-tabstrip::-webkit-scrollbar-track { background: transparent; }
.js-tabstrip::-webkit-scrollbar-thumb {
  background: var(--rule);
  border-radius: 3px;
}

/* The drawer scrolls down instead, and needs the bar for the same reason. */
@media (max-width: 720px) {
  .js-tabstrip::-webkit-scrollbar { width: 6px; height: 0; }
}


/* ── two tables that do not fit a phone ───────────────────────────────────
   The accounts list squeezed its fields to fit the screen instead of letting
   the table scroll: the role read «موظ» and the name box was a sliver. Each
   field keeps a usable width now, and the row scrolls sideways as intended.

   The edit history put its one informative column — التفاصيل — last, which
   on a phone is off the far edge; the rest of the row (time, section,
   action) says little without it. There each entry becomes a small card:
   the facts on one line, who and what changed beneath. */
.st-accts td .st-input { min-width: 9em; }
.st-accts td .st-select { min-width: 7.5em; }

@media (max-width: 720px) {
  .st-hist thead { display: none; }
  .st-hist, .st-hist tbody { display: block; }
  .st-hist tr {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 12px;
    padding: 10px 2px;
    border-top: 1px solid var(--rule);
  }
  .st-hist td {
    display: block;
    border: 0 !important;
    padding: 0 !important;
    white-space: normal !important;
  }
  .st-hist td:nth-child(5) { flex-basis: 100%; color: var(--ink-3); font-size: 11.5px; }
  .st-hist td:nth-child(6) { flex-basis: 100%; color: var(--ink); overflow-wrap: break-word; }
}

/* A line the sheet pays differently from daily × days (049). */
.st-sheetdiff { color: var(--warn, #d9a100); white-space: normal !important; }

/* ═══════════════════════════════════════════════════════════════════════════
   التبليغات (announcements.js) — a conversation, newest at the bottom
   ═══════════════════════════════════════════════════════════════════════════ */

/* The unread count on the tab, and a dot on the phone's menu button (the tabs
   are in the drawer there). Red only when something tags this person. */
.js-stafftab[data-unread]::after {
  content: attr(data-unread);
  display: inline-block;
  min-width: 18px;
  height: 18px;
  margin-inline-start: 6px;
  padding: 0 5px;
  border-radius: var(--r-pill);
  background: var(--ink-2);
  color: var(--bg);
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  vertical-align: 1px;
}
.js-stafftab[data-tagged]::after { background: var(--accent); color: var(--on-accent); }
html[data-news-unread] .js-navtoggle { position: relative; }
html[data-news-unread] .js-navtoggle::after {
  content: '';
  position: absolute;
  top: 5px;
  inset-inline-end: 5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--panel);
}

/* Laid out like every other tab: the title row across the full width, from
   the right edge. It used to be a 760px column centred in the page, so on a
   computer the title and the whole conversation floated in the middle while
   every other tab started at the right. The messages and the composer keep a
   readable width, aligned to the right under the title. */
.an-screen { max-width: none; margin: 0; }
.an-screen > .an-list,
.an-screen > .an-compose,
.an-screen > .an-readonly { max-width: 760px; margin-inline-start: 0; margin-inline-end: auto; }
/* Centred in its row on a computer only. On a phone the head stacks, and
   centring pulled the title and the notification note in from the right edge. */
@media (min-width: 721px) { .an-top { align-items: center; } }
.an-push { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.an-pushon { font-size: 12.5px; color: var(--pos); font-weight: 600; }
.an-pushnote { font-size: 12px; color: var(--ink-3); line-height: 1.6; max-width: 420px; }
.an-pusherr { color: var(--neg); flex-basis: 100%; max-width: 560px; }

.an-list { display: flex; flex-direction: column; gap: 10px; padding-bottom: 12px; }
.an-older { align-self: center; }
.an-none { text-align: center; }
.an-day {
  align-self: center;
  margin: 8px 0 2px;
  padding: 3px 12px;
  border-radius: var(--r-pill);
  background: var(--panel-2);
  border: 1px solid var(--rule);
  color: var(--ink-3);
  font-size: 11.5px;
  font-weight: 600;
}
.an-newline {
  display: flex; align-items: center; gap: 10px;
  color: var(--accent); font-size: 11.5px; font-weight: 700;
}
.an-newline::before, .an-newline::after { content: ''; flex: 1 1 auto; height: 1px; background: var(--accent); opacity: .5; }

/* One announcement: a card, the author's name and time on top. Mine lean to
   the reading end like a sent message; one that tags me carries the accent. */
.an-msg {
  position: relative;
  max-width: min(100%, 620px);
  align-self: flex-start;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
  border-start-start-radius: 4px;
  padding: 12px 14px 12px;
  box-shadow: var(--shadow);
}
.an-msg--mine { align-self: flex-end; border-start-start-radius: var(--r-card); border-start-end-radius: 4px; background: var(--panel-2); }
.an-msg--me { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow); }
.an-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.an-author { font-size: 13.5px; color: var(--ink); }
.an-time { font-size: 11.5px; color: var(--ink-4); }
.an-forme {
  font-size: 11px; font-weight: 700;
  padding: 1px 8px; border-radius: var(--r-pill);
  background: var(--accent); color: var(--on-accent);
}
.an-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 7px; }
.an-tag {
  font-size: 12px; font-weight: 600;
  padding: 1px 8px; border-radius: var(--r-pill);
  background: var(--wash); color: var(--accent);
}
.an-tag--all, .an-tag--me { background: var(--accent); color: var(--on-accent); }
.an-body {
  font-size: 14.5px; line-height: 1.75; color: var(--ink);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
/* ⋮ — the message's own menu, in the corner opposite the name. */
.an-msg--menu .an-head { padding-inline-end: 34px; }
.an-more { position: absolute; top: 8px; inset-inline-end: 8px; }
.an-dots {
  width: 30px; height: 30px; padding: 0;
  border: 0; border-radius: var(--r-control);
  background: transparent; color: var(--ink-3);
  font: inherit; font-size: 20px; font-weight: 700; line-height: 1; cursor: pointer;
}
.an-dots:hover, .an-dots[aria-expanded="true"] { background: var(--panel-2); color: var(--ink); }
.an-menu {
  position: absolute; top: 34px; inset-inline-end: 0; z-index: 20;
  min-width: 150px; padding: 6px;
  background: var(--panel); border: 1px solid var(--rule-2);
  border-radius: var(--r-control); box-shadow: var(--shadow-modal);
  display: flex; flex-direction: column;
}
.an-menu[hidden] { display: none; }
.an-item {
  text-align: start; padding: 9px 12px;
  border: 0; border-radius: var(--r-chip);
  background: transparent; color: var(--ink);
  font: inherit; font-size: 13.5px; cursor: pointer;
}
.an-item:hover { background: var(--panel-2); }
.an-item--danger { color: var(--neg); }
.an-item--armed { background: var(--neg); color: var(--on-neg); font-weight: 700; }
.an-item--armed:hover { background: var(--neg); }

/* «مُعدّل» — seen by the author only. */
.an-edited {
  font-size: 11px; font-weight: 600;
  padding: 1px 8px; border-radius: var(--r-pill);
  background: var(--panel-2); color: var(--ink-3); border: 1px solid var(--rule);
}
.an-editbox { display: flex; flex-direction: column; gap: 8px; margin-top: 2px; }
.an-editbox .an-row .st-btn { flex: none; white-space: nowrap; }

.an-readonly {
  text-align: center; font-size: 12.5px; color: var(--ink-4);
  margin: 10px 0 24px;
}

/* The composer stays under the thumb while the conversation scrolls. */
.an-compose {
  position: sticky;
  bottom: 0;
  z-index: 5;
  margin-top: 8px;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-toast);
  display: flex; flex-direction: column; gap: 8px;
}
.an-text { width: 100%; min-height: 48px; resize: none; line-height: 1.6; font-size: 14.5px; }
.an-row { display: flex; align-items: center; gap: 8px; }
.an-who { flex: 1 1 auto; min-width: 0; font-size: 12px; color: var(--ink-3); }
.an-send { min-width: 84px; }
.an-tagbtn, .an-send { white-space: nowrap; flex: none; }
.an-status { margin: 0; font-size: 12px; color: var(--ink-3); line-height: 1.6; }
.an-status:empty { display: none; }
.an-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.an-chips:empty { display: none; }
.an-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 4px 2px 10px;
  border-radius: var(--r-pill);
  background: var(--wash); color: var(--accent);
  font-size: 12.5px; font-weight: 600;
}
.an-chipx {
  width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: inherit; font: inherit; font-size: 15px; line-height: 1; cursor: pointer;
}
.an-chipx:hover { background: var(--accent); color: var(--on-accent); }
.an-picker { border-top: 1px solid var(--rule); padding-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.an-picker[hidden] { display: none; }
.an-options { max-height: 240px; overflow-y: auto; display: flex; flex-direction: column; }
.an-option {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 6px; border-radius: var(--r-control); cursor: pointer;
}
.an-option:hover { background: var(--panel-2); }
.an-option input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.an-option--all { font-weight: 700; border-bottom: 1px solid var(--rule); border-radius: 0; }
.an-optname { display: flex; flex-direction: column; line-height: 1.35; }
.an-optname small { color: var(--ink-4); font-size: 11px; }

@media (max-width: 720px) {
  .an-msg { max-width: 100%; }
  .an-compose { border-radius: var(--r-card) var(--r-card) 0 0; margin-inline: -4px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   الحسابات — compact list, one person opened in place
   ═══════════════════════════════════════════════════════════════════════════ */
.ac-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.ac-newbtn { white-space: nowrap; }
.ac-new { margin-bottom: 14px; }
.ac-new[hidden] { display: none; }

.ac-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.ac-search { flex: 1 1 220px; height: 36px; }
.ac-seg { display: inline-flex; padding: 3px; border: 1px solid var(--rule); border-radius: var(--r-control); background: var(--panel); }
.ac-segbtn {
  appearance: none; border: 0; background: transparent; color: var(--ink-3);
  font: inherit; font-size: 12.5px; font-weight: 600; padding: 5px 12px;
  border-radius: calc(var(--r-control) - 3px); cursor: pointer;
}
.ac-segbtn[aria-pressed="true"] { background: var(--panel-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--rule-2); }

/* The list: one line per account, the whole line is the button. */
.ac-list {
  background: var(--panel); border: 1px solid var(--rule); border-radius: var(--r-card);
  overflow: hidden;
}
.ac-row { position: relative; }
.ac-row + .ac-row { border-top: 1px solid var(--rule); }
.ac-row.is-open { background: var(--panel-2); }
.ac-line {
  appearance: none; width: 100%; display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border: 0; background: transparent; color: inherit;
  font: inherit; text-align: start; cursor: pointer;
}
.ac-line:hover { background: var(--panel-2); }
.ac-av {
  flex: 0 0 36px; width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 800; font-size: 15px;
  background: var(--panel-2); color: var(--ink-2); border: 1px solid var(--rule);
}
.ac-av--owner, .ac-av--editor { background: var(--wash); color: var(--accent); border-color: transparent; }
.ac-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ac-name { font-size: 14px; font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: 6px; overflow-wrap: anywhere; }
.ac-you { font-size: 10.5px; font-weight: 700; padding: 0 6px; border-radius: var(--r-pill); background: var(--panel-2); color: var(--ink-3); border: 1px solid var(--rule); }
.ac-sub { font-size: 12px; color: var(--ink-3); display: flex; gap: 5px; flex-wrap: wrap; }
.ac-user { direction: ltr; unicode-bidi: isolate; }
.ac-dot { color: var(--ink-4); }
.ac-tags { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
.ac-role {
  font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: var(--r-pill);
  background: var(--panel-2); color: var(--ink-2); border: 1px solid var(--rule); white-space: nowrap;
}
.ac-role--owner { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.ac-role--editor { background: var(--wash); color: var(--accent); border-color: transparent; }
.ac-flag { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: var(--r-pill); background: var(--neg); color: var(--on-neg); white-space: nowrap; }
.ac-flag--soft { background: transparent; color: var(--warn); border: 1px solid var(--warn); }
.ac-seen { flex: 0 0 auto; font-size: 11.5px; color: var(--ink-4); white-space: nowrap; min-width: 72px; text-align: end; }
.ac-chev { flex: 0 0 auto; color: var(--ink-4); font-size: 16px; transition: transform .15s; }
.ac-row.is-open .ac-chev { transform: rotate(180deg); }

/* One person, opened under their row. */
.ac-detail { padding: 4px 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.ac-banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 12px; border-radius: var(--r-control);
  background: var(--wash); color: var(--ink); font-size: 12.5px; border: 1px solid var(--accent);
}
.ac-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 10px; }
.ac-card { background: var(--panel); border: 1px solid var(--rule); border-radius: var(--r-card); padding: 12px 14px; min-width: 0; }
.ac-cardtitle { font-size: 13px; font-weight: 800; color: var(--ink); margin: 0 0 8px; }
.ac-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; }
.ac-actions { display: flex; justify-content: flex-end; margin-top: 10px; }
.ac-secret { display: flex; align-items: center; gap: 12px; min-height: 32px; margin-bottom: 8px; }
.ac-pw { font-family: var(--mono); font-size: 15px; font-weight: 700; letter-spacing: .06em; color: var(--ink); }
.ac-pwset { display: flex; gap: 6px; }
.ac-pwset .st-input { flex: 1 1 auto; }
.ac-pwset .st-btn { flex: none; }
.ac-card .st-note { margin: 8px 0 0; }

/* Access: a switch per screen, then the documents and sheets folded. */
.ac-tgs { display: flex; flex-direction: column; }
.ac-tg { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-top: 1px solid var(--rule); }
.ac-tg:first-child { border-top: 0; }
.ac-tg.is-dirty .ac-tgname::after { content: " \2022"; color: var(--accent); font-weight: 800; }
.ac-tglabel { display: flex; align-items: center; gap: 10px; flex: 1 1 auto; min-width: 0; cursor: pointer; }
.ac-tglabel.is-dirty .ac-sw { box-shadow: 0 0 0 2px var(--accent); }
.ac-tgname { font-size: 13.5px; color: var(--ink); overflow-wrap: anywhere; }
.ac-src { font-size: 11px; color: var(--ink-4); white-space: nowrap; }
.ac-src--own { color: var(--warn); font-weight: 700; }
.ac-items { margin-top: 8px; border-top: 1px solid var(--rule); padding-top: 6px; }
.ac-items > summary { cursor: pointer; font-size: 12.5px; font-weight: 700; color: var(--ink-2); padding: 6px 0; }
.ac-tgs--items { padding-inline-start: 4px; max-height: 320px; overflow-y: auto; }

/* The switch itself: a real checkbox, drawn as a switch. */
.ac-sw {
  appearance: none; -webkit-appearance: none; flex: 0 0 auto;
  width: 36px; height: 20px; border-radius: 999px; margin: 0;
  background: var(--rule-2); position: relative; cursor: pointer; transition: background .15s;
}
.ac-sw::after {
  content: ""; position: absolute; top: 2px; inset-inline-start: 2px;
  width: 16px; height: 16px; border-radius: 50%; background: var(--panel);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .3); transition: inset-inline-start .15s;
}
.ac-sw:checked { background: var(--pos); }
.ac-sw:checked::after { inset-inline-start: 18px; }
.ac-sw:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.ac-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding-top: 6px; font-size: 12px;
}
.ac-danger { color: var(--neg); border-color: var(--neg); background: transparent; }

/* Job-title defaults, folded at the bottom. */
.ac-jobs {
  margin-top: 14px; background: var(--panel); border: 1px solid var(--rule);
  border-radius: var(--r-card); padding: 10px 14px;
}
.ac-jobs > summary { cursor: pointer; font-size: 13.5px; font-weight: 800; color: var(--ink); padding: 4px 0; }
.ac-jobs > .st-sub { margin: 4px 0 10px; }
.ac-jobtable td:not(:first-child), .ac-jobtable th:not(:first-child) { text-align: center; }
.ac-jobtable .ac-tglabel { justify-content: center; }

@media (max-width: 720px) {
  .ac-line { flex-wrap: wrap; gap: 8px 10px; padding: 10px 40px 10px 12px; }
  [dir="rtl"] .ac-line { padding: 10px 12px 10px 40px; }
  .ac-main { flex: 1 1 calc(100% - 50px); }
  .ac-tags { order: 3; justify-content: flex-start; margin-inline-start: 46px; }
  .ac-seen { order: 4; min-width: 0; margin-inline-start: auto; }
  .ac-chev { position: absolute; top: 18px; inset-inline-end: 14px; }
  .ac-fields { grid-template-columns: 1fr; }
  .ac-detail { padding: 2px 10px 12px; }
}

/* The guide files and checklists of one person, one row per section. */
.ac-pairs { width: 100%; border-collapse: collapse; font-size: 13px; }
.ac-pairs th { font-size: 11px; font-weight: 700; color: var(--ink-3); text-align: center; padding: 6px 6px; border-bottom: 1px solid var(--rule-2); }
.ac-pairs th:first-child { text-align: start; }
.ac-pairs td { padding: 6px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.ac-pairs tr:last-child td { border-bottom: 0; }
.ac-pairname { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.ac-paircell { text-align: center; width: 30%; }
.ac-tg--cell { border-top: 0; padding: 0; justify-content: center; gap: 6px; }
.ac-tg--cell .ac-tglabel { flex: 0 0 auto; }

/* ═══════════════════════════════════════════════════════════════════════════
   A checklist handed in as a photo (خدمة التنظيف) — big targets, three
   languages, the photos as thumbnails that open full size.
   ═══════════════════════════════════════════════════════════════════════════ */
.ph-say { margin: 10px 0 12px; padding: 10px 12px; border-radius: var(--r-control);
  background: var(--panel-2); border: 1px solid var(--rule); display: flex; flex-direction: column; gap: 4px; }
.ph-say p { margin: 0; line-height: 1.6; }
.ph-ar { font-size: 14px; font-weight: 600; color: var(--ink); }
.ph-en { font-size: 13px; color: var(--ink-2); text-align: left; }
.ph-ur { font-size: 14px; color: var(--ink-2); font-family: "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", var(--body); line-height: 2; }
.ph-need { border-color: var(--warn); }
.ph-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.ph-shoot {
  flex: 1 1 220px; height: auto; min-height: 64px; padding: 10px 16px;
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  font-size: 16px; border-radius: var(--r-card);
}
.ph-ico { font-size: 26px; line-height: 1; }
.ph-lines { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.ph-lines small, .ph-pick small { font-size: 11.5px; font-weight: 600; opacity: .85; }
.ph-pick { flex: 0 1 160px; height: auto; min-height: 64px; display: inline-flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px; border-radius: var(--r-card); }
.ph-status { min-height: 1.2em; }
.ph-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-top: 10px; }
.ph-thumb { position: relative; aspect-ratio: 3 / 4; border-radius: var(--r-control); overflow: hidden;
  background: var(--panel-2); border: 1px solid var(--rule); }
.ph-open { display: block; width: 100%; height: 100%; }
.ph-open img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph-num { position: absolute; bottom: 6px; inset-inline-start: 6px; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 999px; background: rgba(0, 0, 0, .6); color: #fff; font-size: 12px; font-weight: 700;
  display: grid; place-items: center; }
.ph-rm { position: absolute; top: 6px; inset-inline-end: 6px; min-width: 28px; height: 28px; padding: 0 8px;
  border: 0; border-radius: 999px; background: rgba(0, 0, 0, .6); color: #fff; font: inherit;
  font-size: 16px; font-weight: 700; line-height: 1; cursor: pointer; }
.ph-rm.is-armed { background: var(--neg); color: var(--on-neg); font-size: 12px; }

/* ── 055: salary handed over, end of service, job defaults in الإعدادات ── */
.st-chip {
  display: inline-block; margin-inline-start: 8px; vertical-align: 1px;
  font-size: 10.5px; font-weight: 700; padding: 1px 8px; border-radius: var(--r-pill);
  background: var(--panel-2); color: var(--ink-3); border: 1px solid var(--rule);
}
.st-chip--paid { background: transparent; color: var(--pos); border-color: var(--pos); }
.st-chip--ended { background: transparent; color: var(--neg); border-color: var(--neg); }
.st-pcard.is-ended { opacity: .6; }
.st-dutyseg { flex: 0 0 auto; }
.st-segbtn--ended[aria-selected="true"] { color: var(--neg); }

.st-paid {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 10px 0 14px; padding: 10px 12px; border-radius: var(--r-control);
  background: var(--panel-2); border: 1px solid var(--rule);
}
.st-paidyes { color: var(--pos); font-weight: 800; }
.st-paidno { color: var(--ink-2); font-weight: 600; flex: 1 1 auto; }
.st-paidcell { text-align: center; }
.st-paidcell input { width: 18px; height: 18px; accent-color: var(--pos); cursor: pointer; }

.st-endbox { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--rule-2); display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.st-endbox .st-fields { width: 100%; }
.st-btn--warnline { color: var(--neg); border-color: var(--neg); background: transparent; }

/* The job-title defaults, added to the end of the workbook's الإعدادات grid:
   across the full width rather than squeezed into one of its columns. */
.js-settings > .js-jobdefaults { grid-column: 1 / -1; margin: 0; }
.ac-jobsnote { margin-top: 12px; }

/* انهاء خدمات in جدول الشهر: the line stays, dimmed and labelled. */
.st-paytable tr.is-ended td { background: color-mix(in srgb, var(--neg) 7%, transparent); }
.st-paytable tr.is-ended .st-cell { opacity: .7; }
.st-rowchip { display: block; width: max-content; margin: 4px 0 2px; margin-inline-start: 0; }

/* ═══════════════════════════════════════════════════════════════════════════
   جرد الأراكيل (hookah.js) — the handover count as a table of small number
   cells, the two shifts told apart by a tint on their headings.
   ═══════════════════════════════════════════════════════════════════════════ */
.hk-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 8px; }
.hk-bar .st-field { min-width: 160px; }
.hk-bar .st-select { min-width: 200px; }
/* The working day, shown rather than chosen (066). */
.hk-today { display: block; padding: 9px 0; font-size: 14px; line-height: 1.4; }
.hk-today .st-dim { font-size: 12.5px; }
.hk-status { margin-inline-start: auto; }
.hk-coalnote { margin: 0 0 12px; }
.hk-panel { margin-bottom: 12px; }
.hk-h { margin: 22px 0 8px; font-size: 15px; }
.hk-h4 { margin: 16px 0 4px; font-size: 13.5px; }
.hk-table { min-width: 760px; }
.hk-table th, .hk-table td { text-align: center; vertical-align: middle; }
.hk-table thead th { white-space: normal; line-height: 1.35; font-size: 11.5px; }
/* The flavours read like the other row labels of the table (المجموع aside),
   not brighter than the figures they label. */
.hk-table th.hk-flavor { text-align: start; white-space: nowrap; font-size: 11.5px; }
.hk-table thead th.hk-am { background: color-mix(in srgb, var(--accent, #e11d2e) 7%, transparent); }
.hk-table thead th.hk-pm { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.hk-num { width: 100%; min-width: 58px; max-width: 86px; padding: 6px 6px; text-align: center;
  font-family: var(--mono); font-variant-numeric: tabular-nums; direction: ltr; }
.hk-coalrow th, .hk-coalrow td { border-top: 1px dashed var(--rule-2); }
.hk-table tfoot th { text-align: start; font-size: 11.5px; white-space: normal; }
.hk-table tfoot td { font-size: 11.5px; white-space: nowrap; }
.hk-total th, .hk-total td { font-weight: 800; color: var(--ink); }
.hk-ro td { font-family: var(--mono); }
.hk-sum { margin: 12px 0 6px; }
.hk-sum .st-sumnum { font-size: 16px; }
.hk-rank { min-width: 640px; }
.hk-rank td, .hk-rank th { white-space: nowrap; }
.hk-pct { display: block; height: 3px; margin-top: 4px; border-radius: 2px;
  background: linear-gradient(to left, var(--ink-2) var(--w, 0%), var(--rule) var(--w, 0%)); }
.hk-flist { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 8px; max-width: 520px; }
.hk-frow { display: flex; gap: 6px; align-items: center; }
.hk-frow .st-input { flex: 1 1 auto; }
.hk-frow.is-off .st-input, .hk-coaltable tr.is-off input { opacity: .5; text-decoration: line-through; }
.hk-coaltable { min-width: 860px; }
.hk-coaltable td { vertical-align: middle; }
.hk-coaltable td:first-child .st-input { min-width: 150px; }
.hk-rowact { white-space: nowrap; display: flex; gap: 4px; }
.hk-actions { margin-top: 12px; align-items: center; gap: 10px; }
/* On a phone the count scrolls sideways; the flavour stays in view. */
.hk-table th.hk-flavor, .hk-table thead tr:first-child th:first-child, .hk-table tfoot th {
  position: sticky; inset-inline-start: 0; z-index: 1; background: var(--panel); }
.hk-table thead tr:first-child th:first-child { z-index: 2; }
/* Tobacco grams: the two ends of one range, side by side under one heading. */
.hk-grams { display: flex; gap: 10px; align-items: flex-end; margin-top: 4px; }
.hk-grams .st-field { flex: 0 0 auto; }
.hk-grams .hk-num { width: 90px; max-width: 90px; }
/* The paper sheet's flavour colours, softened for the screen: a tint of the
   colour behind the name and the colour itself as an edge. Mixed with the
   panel, so it is opaque (the column is pinned while scrolling) and follows
   the light and dark themes. */
.hk-table th.hk-tinted {
  background: color-mix(in srgb, var(--fc) 16%, var(--panel));
  color: color-mix(in srgb, var(--fc) 45%, var(--ink-2));
  box-shadow: inset -3px 0 0 color-mix(in srgb, var(--fc) 70%, var(--panel));
}
.hk-color { width: 34px; height: 34px; padding: 2px; border: 1px solid var(--rule); border-radius: 8px;
  background: var(--panel-2); cursor: pointer; flex: 0 0 auto; }
.st-personacts { margin-top: 12px; gap: 8px; flex-wrap: wrap; }
.st-personacts .st-btn[aria-pressed="true"] { background: var(--panel-2); }
.st-actbox .st-endbox { margin-top: 0; padding-top: 0; border-top: 0; }
.st-actbox .st-danger { margin: 0; }
.st-dellist { margin: 6px 0 8px; padding-inline-start: 18px; }
.st-dellist li { margin: 2px 0; }
/* جرد الأراكيل on a phone: one shift, fitting the width, big boxes to tap. */
.hk-shiftseg { display: flex; width: 100%; margin: 4px 0 10px; }
.hk-shiftseg .st-segbtn { flex: 1 1 0; }
.hk-table.hk-phone { min-width: 0; width: 100%; table-layout: fixed; }
.hk-table.hk-phone th, .hk-table.hk-phone td { padding: 6px 3px; }
.hk-table.hk-phone thead th { white-space: normal; font-size: 10.5px; line-height: 1.3; vertical-align: bottom;
  position: sticky; top: 0; z-index: 3; background: var(--panel); }
.hk-table.hk-phone thead th:first-child { width: 30%; }
.hk-table.hk-phone th.hk-flavor { white-space: normal; font-size: 11.5px; line-height: 1.3; padding-inline: 8px 4px; position: static; }
.hk-table.hk-phone .hk-num { min-width: 0; max-width: none; width: 100%; height: 42px; font-size: 16px; padding: 4px 2px; }
.hk-panel:has(.hk-phone), .hk-panel:has(.hk-phone) .st-scroll { overflow: visible; }
.hk-table.hk-phone-pm thead th:first-child { width: 22%; }
.hk-table.hk-phone-pm thead th { font-size: 9.5px; }
.hk-table.hk-phone thead th { letter-spacing: 0; padding-inline: 1px; }
@media (max-width: 640px) {
  .hk-bar .st-field { min-width: 0; flex: 1 1 140px; }
  .hk-bar .st-select { min-width: 0; width: 100%; }
  .hk-status { flex: 1 0 100%; margin: 0; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   الحجوزات (reservations.js) — the seat map, the day's bookings, the history.
   ═══════════════════════════════════════════════════════════════════════════ */
.rs-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 12px; }
.rs-bar .st-field { min-width: 150px; }
.rs-dayname { align-self: center; }
.rs-bar .st-btn--go { margin-inline-start: auto; }
.rs-count { margin: 4px 0 10px; }
.rs-now { background: var(--panel); border: 1px solid var(--rule); border-radius: var(--r-card);
  padding: 10px 12px; margin-bottom: 12px; }
.rs-nowcells { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; margin-top: 6px; }
.rs-nowcell { display: flex; flex-direction: column; gap: 2px; padding: 6px 8px; border-radius: var(--r-control);
  background: var(--panel-2); }
.rs-nowname { font-size: 12px; color: var(--ink-3); }
.rs-nownum { font-family: var(--mono); font-size: 16px; font-weight: 700; color: var(--pos); direction: ltr; text-align: start; }
.rs-nowcell.is-full .rs-nownum { color: var(--neg); }
.rs-list { display: flex; flex-direction: column; gap: 10px; }
.rs-card { margin: 0; }
.rs-card.is-cancelled, .rs-card.is-no_show { opacity: .55; }
.rs-cardtop { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
/* «3:00 م – 6:00 م» reads right to left like the rest of the card. */
.rs-time { font-weight: 700; font-size: 15px; color: var(--ink); }
.rs-status--booked { color: var(--ink-2); }
.rs-status--arrived { color: var(--pos); border-color: var(--pos); }
.rs-status--finished { color: var(--ink-3); border-color: var(--rule-2); }
.rs-card.is-finished { opacity: .75; }
.rs-status--no_show, .rs-status--cancelled { color: var(--neg); border-color: var(--neg); }
.rs-who { margin: 6px 0; font-size: 14px; }
.rs-phone { direction: ltr; unicode-bidi: isolate; }
.rs-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.rs-seatchip { font-size: 11.5px; padding: 2px 8px; border-radius: var(--r-pill); background: var(--panel-2);
  border: 1px solid var(--rule); color: var(--ink-2); }
.rs-seatchip.is-master, .rs-seat.is-master { border-color: color-mix(in srgb, #b58cff 60%, var(--rule)); }
.rs-seatchip.is-vip, .rs-seat.is-vip { border-color: color-mix(in srgb, #e8b64c 70%, var(--rule)); }
.rs-note { margin: 8px 0 0; font-size: 13px; color: var(--ink-2); white-space: pre-wrap; }
.rs-meta { margin: 6px 0 0; }
.rs-acts { margin-top: 10px; gap: 6px; flex-wrap: wrap; }
.rs-fields { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.rs-hint { margin: 8px 0 0; font-family: var(--mono); }
.rs-h4 { margin: 16px 0 6px; font-size: 14px; }
.rs-h3 { margin: 20px 0 8px; }
.rs-picked { margin: 0 0 8px; }
.rs-map { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.rs-sec { margin: 0; }
.rs-sechead { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.rs-secname { font-weight: 700; color: var(--ink); }
.rs-seats { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; }
.rs-seat { appearance: none; font: inherit; font-size: 12.5px; min-height: 44px; padding: 5px 4px; cursor: pointer;
  border-radius: var(--r-control); border: 1px solid var(--rule); background: var(--panel-2); color: var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; line-height: 1.2; }
.rs-seat small { font-size: 10px; color: var(--ink-3); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rs-seat small.rs-tier { color: #b58cff; }
.rs-seat.is-on { background: color-mix(in srgb, var(--pos) 22%, var(--panel)); border-color: var(--pos); font-weight: 700; }
.rs-seat.is-taken { background: color-mix(in srgb, var(--neg) 12%, var(--panel)); color: var(--ink-3); cursor: not-allowed; }
.rs-seat.is-down { background: repeating-linear-gradient(-45deg, var(--panel-2), var(--panel-2) 6px, var(--panel) 6px, var(--panel) 12px);
  color: var(--ink-4); cursor: not-allowed; }
.rs-seat.is-down small { color: #e8b64c; }
.rs-seat:disabled { opacity: 1; }
.rs-mbox { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; max-width: 420px; }
.rs-actions { margin-top: 12px; gap: 8px; }
.rs-kpi { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.rs-kpi .st-sumnum { direction: rtl; text-align: right; }
.rs-advice { margin-bottom: 12px; }
.rs-advlist { margin: 8px 0; padding-inline-start: 18px; display: flex; flex-direction: column; gap: 6px; }
.rs-adv { line-height: 1.6; }
.rs-adv--warn strong { color: var(--neg); }
.rs-adv--good strong { color: var(--pos); }
.rs-adv--idea strong { color: #e8b64c; }
.rs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.rs-bars { margin: 0; }
.rs-barrow { display: grid; grid-template-columns: minmax(70px, 34%) 1fr auto; align-items: center; gap: 8px; margin: 4px 0; font-size: 12.5px; }
.rs-barlabel { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rs-bartrack { height: 8px; border-radius: 4px; background: var(--panel-2); overflow: hidden; }
.rs-barfill { height: 100%; background: var(--ink-3); border-radius: 4px; }
.rs-barval { font-family: var(--mono); color: var(--ink-2); min-width: 36px; text-align: end; }
.rs-histtable tr.is-cancelled td, .rs-histtable tr.is-no_show td { color: var(--ink-4); }
/* «سُجِّل: حضر» after a button on a notification. */
.rs-toast { position: fixed; inset-inline: 16px; bottom: 24px; z-index: 1000; margin: 0 auto; max-width: 420px;
  padding: 12px 16px; border-radius: var(--r-card); background: var(--panel-2); color: var(--ink);
  border: 1px solid var(--rule-2); box-shadow: var(--shadow-toast, 0 12px 30px rgba(0,0,0,.4)); text-align: center; }
.rs-notecell { white-space: normal; min-width: 160px; }
@media (max-width: 640px) {
  .rs-seats { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); }
  .rs-bar .st-btn--go { margin-inline-start: 0; width: 100%; }
}

/* ── the header ─────────────────────────────────────────────────────────────
   The month picker sits in the top row now, where تصدير Excel was (that is in
   الإعدادات), at the height of the buttons beside it. «الرصيد» shows only on
   the tabs that are about money — اليومية, الشهر, شؤون الموظفين (staff.js sets
   data-money). */
header .js-period { height: 34px !important; font-size: 13px !important; max-width: 180px; }
html:not([data-money]) .js-ticker { display: none !important; }

/* جرد الأراكيل: the other shift's figures, shown and not written (062). */
.hk-num.hk-locked { background: transparent; border-style: dashed; color: var(--ink-3); cursor: default; }

/* ── the seat chart (الحجوزات) ─────────────────────────────────────────────
   Small numbered tiles; colour is the state, the legend says which. */
.rs-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 8px 12px; margin-bottom: 10px;
  border: 1px solid var(--rule); border-radius: var(--r-control); background: var(--panel); font-size: 12px; color: var(--ink-3); }
.rs-legitem { display: inline-flex; align-items: center; gap: 6px; }
.rs-legdot { width: 14px; height: 14px; border-radius: 4px; display: inline-block; border: 1px solid var(--rule-2); background: var(--panel-2); }
.rs-legdot.is-on { background: var(--pos); border-color: var(--pos); }
.rs-legdot.is-taken { background: color-mix(in srgb, var(--neg) 45%, var(--panel)); border-color: color-mix(in srgb, var(--neg) 60%, var(--panel)); }
.rs-legdot.is-down { background: repeating-linear-gradient(-45deg, var(--panel-2), var(--panel-2) 3px, var(--ink-4) 3px, var(--ink-4) 4px); }
.rs-legdot.is-master { border: 2px solid #b58cff; }
.rs-legdot.is-vip { border: 2px solid #e8b64c; }
.rs-sec { padding: 12px 14px; }
.rs-map .rs-sec { background: var(--panel); border: 1px solid var(--rule); border-radius: var(--r-card); }
.rs-sechead { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 4px 10px; margin-bottom: 10px; }
.rs-secname { font-weight: 800; color: var(--ink); font-size: 14px; }
.rs-seccount { font-size: 12px; color: var(--ink-3); }
.rs-secbar { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: var(--panel-2); overflow: hidden; }
.rs-secbar > i { display: block; height: 100%; background: var(--pos); border-radius: 2px; transition: width .2s; }
.rs-sechead.is-full .rs-secbar > i { background: var(--neg); }
.rs-sechead.is-full .rs-seccount { color: var(--neg); }
.rs-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 6px; }
.rs-tile { appearance: none; font: inherit; position: relative; height: 46px; padding: 0; cursor: pointer;
  border-radius: 10px 10px 6px 6px; border: 1px solid var(--rule-2); background: var(--panel-2); color: var(--ink);
  display: grid; place-items: center; transition: background .12s, border-color .12s, transform .08s; }
.rs-tile:hover:not(:disabled) { border-color: var(--ink-3); }
.rs-tile:active:not(:disabled) { transform: scale(.96); }
.rs-tnum { font-family: var(--mono); font-weight: 700; font-size: 14px; direction: ltr; }
.rs-tile.is-master { box-shadow: inset 0 0 0 2px #b58cff; }
.rs-tile.is-vip { box-shadow: inset 0 0 0 2px #e8b64c; }
.rs-tile.is-vip .rs-tnum { font-size: 11px; letter-spacing: .04em; }
.rs-tile.is-on { background: var(--pos); border-color: var(--pos); color: var(--bg); }
.rs-tile.is-taken { background: color-mix(in srgb, var(--neg) 30%, var(--panel)); border-color: color-mix(in srgb, var(--neg) 50%, var(--panel));
  color: color-mix(in srgb, var(--ink) 55%, transparent); cursor: not-allowed; }
.rs-tile.is-down { background: repeating-linear-gradient(-45deg, var(--panel-2), var(--panel-2) 6px, var(--panel) 6px, var(--panel) 12px);
  color: var(--ink-4); cursor: not-allowed; }
.rs-tile:disabled { opacity: 1; }
@media (max-width: 640px) {
  .rs-tiles { grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 5px; }
  .rs-tile { height: 42px; }
}

/* ── «الإدارة»: الحسابات · سجل التعديلات · الفئات · الإعدادات ──────────────
   One tab on the strip, and this bar above the page while any of the four is
   open (staff.js adminBar). Outside <main> on purpose: a staff section hides
   everything in <main> but its own host. The same segmented look the screens
   use for their own sub-views. */
.js-adminbar { display: none; }
html[data-admin] .js-adminbar {
  display: flex;
  gap: 2px;
  width: fit-content;
  max-width: calc(100% - 32px);
  overflow-x: auto;
  margin: 16px auto 0;
  padding: 3px;
  background: var(--panel-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-control);
}
.js-adminsub {
  appearance: none;
  border: 0;
  background: none;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-3);
  padding: 6px 15px;
  border-radius: calc(var(--r-control) - 1px);
  cursor: pointer;
  white-space: nowrap;
}
.js-adminsub:hover { color: var(--ink); }
.js-adminsub[aria-selected="true"] {
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .12);
}
.js-tabstrip > button[data-ledger-tab="cats"],
.js-tabstrip > button[data-ledger-tab="settings"] { display: none !important; }
/* On a phone its sections share the width equally rather than running off
   the edge behind a scrollbar («الإعدادات» was cut to «الإعدادا»). Here, after
   the rule above: responsive.css loads first, so it cannot override this. */
@media (max-width: 720px) {
  html[data-admin] .js-adminbar {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    width: auto;
    max-width: none;
    margin: 12px 14px 0;
    overflow: visible;
  }
  .js-adminsub { padding: 7px 4px; font-size: 12px; }
}

/* ── «اليوم» ────────────────────────────────────────────────────────────── */
.td-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: 14px;
  align-items: start;
}
.td-grid > .st-panel { margin-bottom: 0; }
.td-h { font-size: 14.5px; font-weight: 700; color: var(--ink); margin: 0 0 12px; }
.td-hrow { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.td-count { font-size: 12px; font-weight: 600; color: var(--ink-3); white-space: nowrap; }
.td-count--miss { color: var(--neg); }
.td-lead { display: flex; flex-direction: column; gap: 2px; }
.td-leadnum {
  font-family: var(--mono);
  font-size: 30px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  direction: ltr;
  text-align: right;
  color: var(--ink);
  line-height: 1.1;
}
.td-stats { gap: 10px 22px; }
.td-foot { margin: 12px 0 0; }
.td-go { margin-top: 14px; }
.td-tasks { list-style: none; margin: 0; padding: 0; }
.td-task + .td-task { border-top: 1px solid var(--rule); }
.td-taskbtn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  appearance: none;
  border: 0;
  background: none;
  font-family: inherit;
  color: var(--ink);
  text-align: start;
  padding: 10px 2px;
  cursor: pointer;
}
.td-taskbtn:hover .td-taskname { color: var(--accent); }
.td-taskname { flex: 1 1 auto; min-width: 0; font-size: 13.5px; font-weight: 600; }
.td-prog, .td-time {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  direction: ltr;
}
/* «8:30 م» and «4 أشخاص» are words with figures in them: right to left. */
.td-time { color: var(--ink-2); font-weight: 600; min-width: 62px; direction: rtl; font-family: inherit; }
.td-note { font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.me-date { font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.td-st {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: var(--r-pill);
  border: 1px solid var(--rule);
  color: var(--ink-3);
  white-space: nowrap;
}
.td-st--miss { color: var(--neg); border-color: var(--neg); }
.td-st--part { color: var(--warn); border-color: var(--warn); }
.td-st--done { color: var(--pos); border-color: var(--pos); }
.td-alerts { margin-top: 14px; }
.td-toggle { display: inline-flex; align-items: center; gap: 8px; margin: 12px 0; font-size: 13px; cursor: pointer; }
.td-times { grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); }
.td-savebar { display: flex; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }

/* ── the bell: التبليغات from anywhere ───────────────────────────────────
   In the header beside the theme button, and kept there on a phone too
   (unlike the theme button and sign-out, which move into the drawer): it is
   the one thing in the header that changes on its own. */
.an-bellwrap { position: relative; }
.an-bell {
  position: relative;
  height: 34px;
  width: 34px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--rule);
  background: var(--panel);
  color: var(--ink-2);
  border-radius: var(--r-control);
  cursor: pointer;
}
.an-bell:hover { border-color: var(--rule-2); color: var(--ink); }
.an-bell svg { width: 17px; height: 17px; }
.an-bell[data-count]::after {
  content: attr(data-count);
  position: absolute;
  top: -6px;
  inset-inline-end: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  font-family: var(--mono);
}
.an-bell--ring svg { animation: an-ring 1s cubic-bezier(.36, .07, .19, .97) 2; transform-origin: 50% 10%; }
@keyframes an-ring {
  0%, 100% { transform: rotate(0); }
  15% { transform: rotate(14deg); }
  30% { transform: rotate(-12deg); }
  45% { transform: rotate(9deg); }
  60% { transform: rotate(-6deg); }
  75% { transform: rotate(3deg); }
}
@media (prefers-reduced-motion: reduce) { .an-bell--ring svg { animation: none; } }
.an-drop {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-end: 0;
  width: min(340px, calc(100vw - 24px));
  max-height: min(440px, 70vh);
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .18);
  z-index: 60;
  padding: 6px;
}
.an-drophead {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 8px 10px 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}
.an-drophead span { font-size: 11.5px; font-weight: 600; color: var(--ink-3); }
.an-dropitem {
  display: block;
  width: 100%;
  appearance: none;
  border: 0;
  background: none;
  font-family: inherit;
  text-align: start;
  padding: 9px 10px;
  border-radius: calc(var(--r-card) - 4px);
  cursor: pointer;
  color: var(--ink);
}
.an-dropitem:hover { background: var(--panel-2); }
.an-dropitem--new { background: var(--wash); }
.an-dropmeta { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--ink-3); }
.an-dropmeta strong { color: var(--ink-2); font-weight: 700; }
.an-droptext {
  font-size: 13px;
  margin-top: 3px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.an-dropall {
  display: block;
  width: 100%;
  appearance: none;
  border: 0;
  border-top: 1px solid var(--rule);
  background: none;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--accent);
  padding: 10px;
  margin-top: 4px;
  cursor: pointer;
}
.an-dropnone { padding: 18px 10px; text-align: center; font-size: 12.5px; color: var(--ink-3); }
/* The message a tap on the bell or a notification opened. */
.an-msg--focus { animation: an-focus 2.6s ease-out 1; }
@keyframes an-focus {
  0%, 30% { box-shadow: 0 0 0 3px var(--accent); }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* ── «ملفي» ─────────────────────────────────────────────────────────────── */
.me-ro {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-3);
  border: 1px solid var(--rule);
  border-radius: var(--r-pill);
  padding: 2px 10px;
  white-space: nowrap;
}
.me-pick { max-width: 240px; margin-bottom: 14px; }
.me-stats { margin-top: 0; padding-top: 0; border-top: 0; gap: 14px 28px; }
.me-sub { font-size: 11.5px; }
.me-rec { display: flex; align-items: center; gap: 10px; padding: 9px 2px; }
.me-amt {
  font-family: var(--mono);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  direction: ltr;
  white-space: nowrap;
}
.me-kind--bonus { color: var(--pos); border-color: var(--pos); }
.me-kind--deduction { color: var(--neg); border-color: var(--neg); }
.me-kind--advance { color: var(--warn); border-color: var(--warn); }
.me-foot { margin: 12px 0 0; }

/* ── the balance a month carries over (carry.js) ─────────────────────────── */
.cr-warn { border-inline-start: 3px solid var(--warn); }
.cr-h { font-size: 14px; font-weight: 800; color: var(--warn); margin: 0 0 8px; }
.cr-figs { margin: 0 0 6px; line-height: 1.9; }
.cr-num { font-family: var(--mono); direction: ltr; unicode-bidi: isolate; white-space: nowrap; }
.cr-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
/* Appended to الإعدادات's grid (never ahead of the template's own nodes) and
   drawn first, across the whole width. */
.js-settings > .js-carry { grid-column: 1 / -1; order: -1; margin: 0; }
.td-screen > .js-carry { margin-bottom: 16px; }

/* ── the branch's own backup (backup.js) ─────────────────────────────────── */
.bk-card .bk-go { margin-top: 12px; }
.bk-card .bk-when { margin: 10px 0 0; }
.bk-card .bk-status:empty { display: none; }
.bk-remind { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 16px;
             padding: 10px 14px; border: 1px dashed var(--rule); border-radius: var(--r-card); }
