/* ==========================================================================
   Labour Life practice system: companies.css. Owner: clients (M1).
   Companies, one company, one worker and their two forms (SPEC 7.4).
   Every class here starts with co- (companies) or wk- (workers). Nothing
   restates a class of the core files. Tokens only, no raw colours.
   Phone first: the base styles are the phone.

     .co-phone-only, .co-wide-only   shown under 720px only, from 720px only
     .co-act-main                    the main header button: full width on a phone
     .co-title, .co-code             the first cell of the companies list
     .co-name (__top), .co-sub       a name with a second, quieter line under it
     .co-contact                     the main contact with a number to call
     .co-figs                        figures that line up (an ID number)
     .co-pre, .co-break              text that keeps its line breaks, a long address that may break anywhere
     .co-panel                       the body of a tab
     .co-card-h, .co-mc (__n __k)    the heading of a card on the Details tab, the main contact in it
     .co-form__same                  "Same as physical" under the postal address
     .co-form__h                     the "Registration numbers" heading in the company form
     .co-oldphone                    a contact's phone number from before contacts became cell only
     .wk-file, .wk-notes             the Details tab of a worker, the notes row
     .wk-periods(-card), .wk-period  the employment periods on the Details tab of a worker (27 Oct 2026)
     .co-sec-h (__n), .co-contacts   the heading row of a section on the Details tab and its count, the Contacts section
     .co-subtabs, .co-point          the sub-tabs of the Company tab, the line under a list that points the way
     .wk-form__h, __co, __pay        the worker form: group heading, company line, pay rate and unit
     .co-storage (__t), .co-storage-dlg   a company's own storage allowance on the Details tab, admins only, and its dialog (27 Oct 2026)
   ========================================================================== */

/* ---------- phone or computer ---------- */

.co-wide-only { display: none; }
@media (min-width: 720px) {
  .co-phone-only { display: none; }
  .co-wide-only { display: inline-flex; }
}
/* On a phone the main action is a full-width button, whatever stands before it. */
@media (max-width: 719px) {
  .co-act-main { flex: 1 1 100%; }
}

/* ---------- lists ---------- */

.co-title { display: grid; gap: 2px; min-width: 0; }
.co-code { font-weight: 600; font-variant-numeric: tabular-nums; }
/* Under the name on a card the code is the quieter line. */
@media (max-width: 719px) {
  .co-code { font-size: var(--fs-sm); font-weight: 600; color: var(--ink-mute); }
}

.co-name { display: grid; gap: 2px; min-width: 0; }
.co-name__top { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s2); min-width: 0; }
.co-sub { font-size: var(--fs-sm); font-weight: 400; color: var(--ink-mute); line-height: var(--lh-snug); overflow-wrap: anywhere; }

.co-contact { display: grid; gap: 2px; min-width: 0; }
/* A number to tap: tall enough for a finger. */
@media (pointer: coarse) {
  .co-contact .link, .co-panel td .link, .co-panel dd > .link { display: inline-flex; align-items: center; min-height: var(--tap); }
}

.co-figs { font-variant-numeric: tabular-nums; }
.co-pre { white-space: pre-line; overflow-wrap: anywhere; }
.co-break { overflow-wrap: anywhere; }

/* ---------- one company, one worker ---------- */

.co-panel { display: grid; gap: var(--s4); min-width: 0; }
.co-panel > * { min-width: 0; }

.co-card-h { margin-bottom: var(--s4); font-size: var(--fs-h3); }

.wk-file { display: grid; gap: var(--s5); max-width: 860px; min-width: 0; }
.wk-file > * { min-width: 0; }

/* ---------- the forms ---------- */

.co-form__same { justify-self: start; }

.wk-form__h {
  margin: var(--s2) 0 var(--s4); padding-bottom: var(--s2);
  border-bottom: 1px solid var(--line-strong);
  font-size: var(--fs-h3);
}
.wk-form__h:first-child { margin-top: 0; }
.wk-form__co { display: grid; gap: var(--s1); margin-bottom: var(--s4); }

/* The amount and what it is for, side by side. */
.wk-form__pay { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 0 var(--s3); align-items: start; }

/* The main contact on the Details tab: the name, then a line per way to reach them. */
.co-mc { display: grid; gap: var(--s2); min-width: 0; }
.co-mc > * { min-width: 0; overflow-wrap: anywhere; }
.co-mc__n { font-size: var(--fs-lg); font-weight: 600; }
.co-mc__k { margin-right: var(--s2); font-size: var(--fs-sm); font-weight: 600; color: var(--ink-mute); }
/* The main contact sits in the narrow column: each label stays above its
   value at every width, so a long label never squeezes an email address. */
.dl.co-mc__dl, .co-mc__dl .dl__row { grid-template-columns: minmax(0, 1fr); }
.co-mc__dl .dl__row { gap: 2px; }
@media (pointer: coarse) {
  .co-mc .link { display: inline-flex; align-items: center; min-height: var(--tap); }
}
/* The group of five registration numbers in the company form (item 79). */
.co-form__h { margin: var(--s2) 0 var(--s1); font-size: var(--fs-h3); }
.co-form__hint { margin-bottom: var(--s3); font-size: var(--fs-sm); }

/* A phone number a contact had before contacts became cell only (item 82):
   the number, a sentence, and the two choices, in the contact form. */
.co-oldphone { display: grid; gap: var(--s2); margin-bottom: var(--s4); }
.co-oldphone .tools { flex-wrap: wrap; }

/* The worker page: the notes use the whole width under their heading. */
.wk-notes dd { grid-column: 1 / -1; }

/* Employment periods on the Details tab (27 Oct 2026): newest first, one row
   each, the dates, how long, and Change and Remove on the earlier ones. */
.wk-periods-card { display: grid; gap: var(--s2); }
.wk-periods-card__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2); }
.wk-periods-card__head .dl__h { margin: 0; }
.wk-periods { display: grid; margin: 0; padding: 0; list-style: none; }
.wk-period {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2);
  padding: var(--s3) 0; border-top: 1px solid var(--line);
}
.wk-period:first-child { border-top: 0; }
.wk-period__main { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s2); min-width: 0; }
.wk-period__span { font-weight: 600; font-variant-numeric: tabular-nums; }
.wk-period__len { font-size: var(--fs-sm); }
.wk-period__acts { display: flex; flex-wrap: wrap; gap: var(--s2); }
@media (pointer: coarse) {
  .wk-period__acts .btn, .wk-periods-card__head .btn { min-height: var(--tap); }
}
.wk-periodform { display: grid; gap: var(--s3); }

/* The groups of a worker on the Details tab (27 Oct 2026): the names, and Edit for editors. */
.wk-groups dd { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s1) var(--s3); }
.wk-groups__names { min-width: 0; overflow-wrap: anywhere; }
.wk-groups__edit { align-self: center; }
@media (pointer: coarse) { .wk-groups__edit { min-height: var(--tap); } }
.wk-groupform { display: grid; gap: var(--s3); min-width: 0; }
.wk-groupform__list { display: grid; gap: var(--s1); min-width: 0; margin: 0; padding: 0; border: 0; }

/* Two fields side by side keep their boxes on one line when only one of them has a hint. */
.co-pair { align-items: start; }

/* ---------- the company page: Details, Company, Employees (14 Oct 2026) ---------- */

/* The Contacts section of Details: a heading row with the count and the add button, then the table. */
.co-contacts { display: grid; gap: var(--s3); min-width: 0; }
.co-sec-h { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2) var(--s3); min-width: 0; }
.co-sec-h h2 { display: inline-flex; align-items: center; gap: var(--s2); font-size: var(--fs-h3); }
/* An old ?tab=contacts address scrolls the heading into sight: it stops a little below the fixed top bar. */
.co-sec-h h2 { scroll-margin-top: calc(var(--top-h) + var(--s4)); }
/* Focus moves here from an old ?tab=contacts address: no ring for a focus the script gave. */
.co-sec-h h2:focus:not(:focus-visible) { outline: none; }
.co-sec-h__n {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: var(--r-pill); background: var(--sunken); color: var(--ink-soft);
  font-size: var(--fs-label); font-weight: 600; font-variant-numeric: tabular-nums;
}
@media (max-width: 719px) {
  .co-sec-h > .btn { flex: 1 1 100%; }
}

/* The sub-tabs of the Company tab: a quieter, smaller row under the main tabs.
   Three sub-tabs with their counts fit at 375px; a longer row scrolls sideways. */
.co-subtabs .tabs { gap: 0; border-bottom-color: var(--line); }
.co-subtabs .tabs__a { padding: 0 var(--s2); font-size: var(--fs-sm); }
.co-subtabs .tabs__a.is-on::after { height: 2px; }
@media (min-width: 520px) {
  .co-subtabs .tabs__a { padding: 0 var(--s3); }
}
.co-subpanel { display: grid; gap: var(--s4); min-width: 0; }
.co-subpanel > * { min-width: 0; }

/* The line under a list of the Company tab that says where the rest is. */
.co-point { font-size: var(--fs-sm); color: var(--ink-mute); line-height: var(--lh-snug); }
.co-pointbox:empty { display: none; }
/* On a touch screen the link stays inline in the sentence (an inline-flex box would fall onto a tall line
   of its own). Vertical padding on an inline link grows its tap area without changing the line box, and the
   taller line keeps the tap areas of two lines apart. */
@media (pointer: coarse) {
  .co-point { line-height: 2; }
  .co-point .link { padding-block: 12px; }
}

/* ---------- the Employees tab: the numbers and many at once (15 Oct 2026, items 97 and 98) ----------
     .co-emp-sum                      "83 active, 562 not active, 645 in total" above the list
     .co-bulk (__body __row __all __n __show __acts __clear __note __match)
                                      "Select all on this page", the number chosen, Show chosen, the two actions and Clear
     .co-bulkform                     the dialog of Make active and Make not active
     .co-chosen (__l __i __name __x)  the list of Show chosen (item 109, 19 Oct 2026) */

.co-emp-sum { font-size: var(--fs-sm); color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.co-emp-sum[hidden] { display: none; }

.co-bulk { min-width: 0; }
.co-bulk__body { display: grid; gap: var(--s2); min-width: 0; }
.co-bulk__row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s4); min-width: 0; }
.co-bulk__all { padding: 0; }
.co-bulk__n { font-weight: 600; font-variant-numeric: tabular-nums; }
.co-bulk__acts { display: flex; flex-wrap: wrap; gap: var(--s2); }
/* With something chosen the bar is a quiet band, so the two actions are easy to find. */
.co-bulk.is-on { padding: var(--s3); border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--red-wash); }
.co-bulk__note { font-size: var(--fs-sm); line-height: var(--lh-snug); }
.co-bulk__note:focus:not(:focus-visible) { outline: none; }
.co-bulk__match { font-weight: 600; }
.co-bulk[hidden] { display: none; }
/* On a computer the number chosen and the actions sit in the row, after "Select all on this page". */
.co-bulk__dock { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s4); min-width: 0; }
@media (pointer: coarse) {
  /* Two classes, so it wins over "button.link { padding: 0 }" of base.css: a 44px tap. */
  .co-bulk .co-bulk__match { display: inline-flex; align-items: center; min-height: var(--tap); padding-block: 0; }
}
@media (max-width: 719px) {
  /* On a phone the bar above the list keeps its height when something is ticked, so the
     list never jumps. The number chosen and the actions are a dock fixed above the bottom
     bar, in reach however far the list is scrolled. */
  .co-bulk.is-on { padding: 0; border: 0; background: none; }
  .co-bulk__dock {
    position: fixed; z-index: var(--z-bottom); left: 0; right: 0;
    bottom: calc(var(--bottom-h) + env(safe-area-inset-bottom, 0px));
    gap: var(--s2) var(--s3);
    padding: var(--s3) calc(var(--s3) + env(safe-area-inset-right, 0px)) var(--s3) calc(var(--s3) + env(safe-area-inset-left, 0px));
    border-top: 1px solid var(--line-strong); background: var(--red-wash);
    box-shadow: var(--shadow-pop);
    /* Three rows (item 109): the number; Show chosen and Clear; then the two actions side by side. */
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center;
  }
  .co-bulk__dock .co-bulk__acts { display: contents; }
  .co-bulk__dock .co-bulk__n { grid-column: 1 / -1; grid-row: 1; }
  .co-bulk__dock .co-bulk__show { grid-column: 1; grid-row: 2; justify-self: start; }
  .co-bulk__dock .co-bulk__clear { grid-column: 2; grid-row: 2; justify-self: end; }
  .co-bulk__dock .co-bulk__acts .btn { grid-row: 3; width: 100%; }
  .kb-open .co-bulk__dock, .has-modal-full .co-bulk__dock { bottom: env(safe-area-inset-bottom, 0px); }
  /* Room under the last card, so the dock never covers it. */
  .co-emp--picking { padding-bottom: 184px; }
}

.co-bulkform { display: grid; gap: var(--s3); min-width: 0; }

/* Show chosen (item 109): one line per person, the name and employee number, the status, and Remove. */
.co-chosen { display: grid; gap: var(--s3); min-width: 0; }
.co-chosen > * { min-width: 0; }
.co-chosen__l { display: grid; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.co-chosen__i {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: var(--s2) var(--s3);
  min-width: 0; padding: var(--s2) 0; border-bottom: 1px solid var(--line);
}
.co-chosen__name { font-weight: 600; overflow-wrap: anywhere; }
@media (max-width: 359px) {
  /* A narrow phone: the status goes under the name, Remove stays on the right. */
  .co-chosen__i { grid-template-columns: minmax(0, 1fr) auto; }
  .co-chosen__i > .badge { grid-column: 1; grid-row: 2; justify-self: start; }
  .co-chosen__x { grid-column: 2; grid-row: 1 / span 2; }
}

/* Item 124 (21 Oct 2026): the line above the Employees list with Export to Excel,
   and the export dialog: which employees, then the columns in two columns. */
.co-emp-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2) var(--s4); min-width: 0; }
.co-emp-top .co-emp-sum { margin: 0; }
.co-emp-top__acts { min-width: 0; }

/* Groups of employees (27 Oct 2026, Jose: Potato and Cabbage at Benco).
     .co-emp-group                    the Group filter beside the status filter (hidden while the company has none)
     .co-bulk__grp                    Add to group and Take out of group in the bar of the chosen employees
     .co-groups (__box __l __i __main __name __acts __del __new __h __make)
                                      the Groups window: each group with its numbers, Show, Rename, Delete, and New group */
.co-emp-group[hidden] { display: none; }
.co-bulk__grp { display: flex; flex-wrap: wrap; gap: var(--s2); min-width: 0; }
@media (max-width: 719px) {
  /* On a phone the group buttons are a fourth row of the dock, side by side. */
  .co-bulk__dock .co-bulk__grp {
    grid-column: 1 / -1; grid-row: 4;
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s2) var(--s3);
  }
  .co-bulk__dock .co-bulk__grp .btn { width: 100%; min-width: 0; }
  .co-bulk__dock .co-bulk__grp .btn:only-child { grid-column: 1 / -1; }
  /* The dock is a row taller: more room under the last card. */
  .co-emp--picking { padding-bottom: 240px; }
}
.co-groups { display: grid; gap: var(--s4); min-width: 0; }
.co-groups > * { min-width: 0; }
.co-groups__l { display: grid; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.co-groups__i {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--s2) var(--s3);
  min-width: 0; padding: var(--s2) 0; border-bottom: 1px solid var(--line);
}
.co-groups__main { display: grid; gap: 2px; min-width: 0; }
.co-groups__name { font-weight: 600; overflow-wrap: anywhere; }
.co-groups__acts { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--s2); min-width: 0; }
.co-groups__del { color: var(--danger-ink); }
.co-groups__new { display: grid; gap: var(--s2); min-width: 0; padding-top: var(--s4); border-top: 1px solid var(--line); }
.co-groups__new .field { margin-bottom: 0; }
.co-groups__h { margin: 0; font-size: var(--fs-h3); }
@media (max-width: 519px) {
  /* A phone: the buttons go under the name and its numbers. */
  .co-groups__i { grid-template-columns: minmax(0, 1fr); }
  .co-groups__acts { justify-content: flex-start; }
}

.co-export { display: grid; gap: var(--s4); min-width: 0; }
.co-export fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: var(--s2); min-width: 0; }
.co-export__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s1) var(--s4); }
@media (max-width: 519px) { .co-export__grid { grid-template-columns: minmax(0, 1fr); } }

/* 22 Oct 2026: the company's logo. Beside the name in the page header, on
   its own card under Details, and small on Home and in lists. A logo keeps
   its own shape inside its box and never stretches. */
.co-logo { display: block; object-fit: contain; background: var(--paper); }
.co-logo--head { display: inline-block; width: auto; height: 1.4em; max-width: 4.5em; margin-right: var(--s3);
  vertical-align: -0.2em; border-radius: var(--r-sm, 4px); }
.co-logo--card { max-width: 220px; max-height: 110px; margin-bottom: var(--s3); }
.co-logo-card { margin-top: var(--s4); }
.co-logo--sm { width: 32px; height: 32px; border-radius: 6px; border: 1px solid var(--line); flex: none; }

/* The registered name beside the status, under a trading name (27 Oct 2026). */
.co-legal { margin-left: .5rem; font-size: var(--fs-sm); color: var(--ink-mute); }

/* A company's own storage allowance (27 Oct 2026, components/company-storage.js):
   a card under the Logo card on the Details tab, admins only. The bar is
   amber from 90% and red when full. */
.co-storage { display: grid; gap: var(--s2); margin-top: var(--s4); }
.co-storage > .co-card-h { margin-bottom: var(--s1); }
.co-storage__t { font-size: var(--fs-lg); font-weight: 600; }
.co-storage > .btns { margin-top: var(--s2); }
.co-storage .progress.is-warn .progress__bar { background: var(--warning); }
.co-storage-dlg { display: grid; gap: var(--s4); }

/* A company only some people see (12 Nov 2026, decision 477,
   components/company-restricted.js). The badge beside the status on the
   company page and in the Companies list: dark, with a lock and its words.
   The window: two choices and, under "Only these people", the people as
   tick boxes in a list that scrolls by itself when it is long. */
.badge--restricted { background: var(--ink); border-color: var(--ink); color: var(--surface); }
/* 20 Nov 2026 (decision 510): the client sees its whole file. */
.badge--client-all { display: inline-flex; align-items: center; gap: 4px; }
.cor { display: grid; gap: var(--s3); min-width: 0; }
.cor__lead { margin: 0; color: var(--ink-soft); }
.cor__box { margin-top: var(--s2); }
.cor__box[hidden] { display: none; }
.cor__people { margin: 0; padding: 0; border: 0; min-width: 0; display: grid; gap: var(--s2); }
.cor__top { margin: 0; }
.cor__top:empty { display: none; }
.cor__list { max-height: min(40vh, 300px); overflow-y: auto; overscroll-behavior: contain; padding-right: var(--s1); }
.cor__p { padding: var(--s1) 0; }
.cor__p[hidden] { display: none; }
.cor__p .check__t { min-width: 0; overflow-wrap: anywhere; }
.cor__note, .cor__none, .cor__count, .cor__fine { margin: 0; }
.cor__count { font-weight: 600; }
.cor__fine { color: var(--ink-soft); font-size: var(--fs-sm); }
