/* ==========================================================================
   Alerts (T3), Upcoming (T4) and Approval (T9) — erp/alerts.html,
   erp/upcoming.html, workflow/detail.html. Phone-first by design (the
   phone is for consulting, see erp/phone.py) but read equally well on a
   tablet or desktop: a single centred column capped at 760px.
   ========================================================================== */
.sig { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: var(--space-4); }
.sig--narrow { max-width: 620px; }
.sig .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.sig-head__title { margin: 0; font-family: var(--font-display); font-size: var(--text-2xl); font-weight: 700; line-height: var(--leading-tight); }
.sig-head__sub { margin: var(--space-1) 0 0; font-size: var(--text-sm); color: var(--text-muted); }
.sig-head--row { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }

/* segmented range switch (7 / 14 / 30 d) */
.sig-seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.sig-seg a { padding: 0 var(--space-3); min-height: 36px; display: inline-flex; align-items: center; font-size: var(--text-sm); font-weight: 600; color: var(--text-muted); text-decoration: none; }
.sig-seg a + a { border-inline-start: 1px solid var(--line); }
.sig-seg a.is-on { background: var(--brand); color: var(--on-brand); }

/* filter chips — scroll sideways inside their own row, never the page */
.sig-chips { display: flex; gap: var(--space-2); overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.sig-chips::-webkit-scrollbar { display: none; }
.sig-chip {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: var(--space-2);
  min-height: 36px; padding: 0 var(--space-3); border: 1px solid var(--line-strong); border-radius: var(--radius-pill);
  background: var(--surface); color: var(--text); font-size: var(--text-sm); font-weight: 600; text-decoration: none; white-space: nowrap;
}
.sig-chip.is-on { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.sig-chip__n { font-size: var(--text-2xs); font-weight: 700; padding: 1px 7px; border-radius: var(--radius-pill); background: var(--surface-sunken); color: var(--text-muted); }
.sig-chip.is-on .sig-chip__n { background: rgba(255, 255, 255, 0.22); color: var(--on-brand); }

/* card + rows */
.sig-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; }
.sig-card__title { margin: 0; padding: var(--space-3) var(--space-4) var(--space-2); font-family: var(--font-display); font-size: var(--text-md); font-weight: 600; }
.sig-group { margin: 0; padding: var(--space-4) var(--space-4) var(--space-1); font-size: var(--text-2xs); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.sig-group:first-child { padding-top: var(--space-3); }
.sig-day { margin: 0; padding: var(--space-4) var(--space-4) var(--space-2); display: flex; justify-content: space-between; align-items: baseline; font-family: var(--font-display); font-size: var(--text-base); font-weight: 700; }
.sig-day__date { font-family: var(--font-body); font-size: var(--text-xs); font-weight: 600; color: var(--text-muted); }

.sig-row {
  display: flex; align-items: center; gap: var(--space-3); min-height: 56px;
  padding: var(--space-3) var(--space-4); border-top: 1px solid var(--line);
  color: var(--text); text-decoration: none;
}
a.sig-row:hover, a.sig-row__main:hover .sig-row__title { background: none; }
a.sig-row:hover { background: var(--surface-hover); }
.sig-row__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; color: inherit; text-decoration: none; }
.sig-row__title { font-size: var(--text-base); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sig-row__sub { font-size: var(--text-xs); color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sig-row__end { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.sig-row__age { font-size: var(--text-xs); color: var(--text-muted); white-space: nowrap; }
.sig-time { width: 44px; flex-shrink: 0; font-size: var(--text-xs); font-weight: 600; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.sig-tag { flex-shrink: 0; font-size: var(--text-2xs); font-weight: 700; color: var(--text-muted); background: var(--surface-sunken); border-radius: var(--radius-xs); padding: 2px 6px; white-space: nowrap; max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
.sig-dot { width: 8px; height: 8px; border-radius: var(--radius-pill); flex-shrink: 0; }
.sig-dot--crit { background: var(--crit); }
.sig-dot--warn { background: var(--warn); }
.sig-dot--info { background: var(--info); }

/* inline approve / refuse on an alert row */
.sig-quick { display: flex; gap: var(--space-2); margin: 0; flex-shrink: 0; }
.sig-quick__btn {
  width: 40px; height: 40px; border-radius: var(--radius-sm); display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; padding: 0;
}
.sig-quick__btn--no { color: var(--crit-fg); }
.sig-quick__btn--yes { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.sig-quick__btn:active { transform: translateY(1px); }

.sig-empty { text-align: center; padding: var(--space-8) var(--space-4); color: var(--text-muted); font-size: var(--text-sm); }
.sig-empty p { margin: 0; }
.sig-empty__title { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 600; color: var(--text); margin-bottom: var(--space-1) !important; }

/* approval summary (T9) */
.sig-summary { padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-3); }
.sig-summary__top { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); }
.sig-summary__title { margin: 0; font-family: var(--font-display); font-size: var(--text-xl); font-weight: 700; line-height: var(--leading-tight); }
.sig-label { font-size: var(--text-xs); color: var(--text-muted); }
.sig-summary__amount { font-family: var(--font-display); font-size: var(--text-3xl); font-weight: 700; line-height: 1.1; }
.sig-facts { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3) var(--space-4); }
.sig-facts dt { font-size: var(--text-xs); color: var(--text-muted); }
.sig-facts dd { margin: 0; font-size: var(--text-sm); font-weight: 600; overflow-wrap: anywhere; }
.sig-note { margin: 0; padding: var(--space-3); border-radius: var(--radius-sm); background: var(--surface-sunken); font-size: var(--text-sm); color: var(--text-muted); }
.sig-link { display: inline-flex; align-items: center; gap: var(--space-1); font-size: var(--text-sm); font-weight: 600; color: var(--brand); text-decoration: none; }

.sig-decide { margin: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.sig-decide__note summary { cursor: pointer; font-size: var(--text-sm); font-weight: 600; color: var(--brand); }
.sig-decide__note textarea { width: 100%; margin-top: var(--space-2); padding: var(--space-3); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); font: inherit; font-size: 16px; resize: vertical; }
.sig-decide__bar { display: flex; gap: var(--space-3); }
.sig-decide__bar .btn { flex: 1; justify-content: center; min-height: 48px; }
.sig-decide__bar .btn-primary { flex: 1.4; }

/* on a phone the decision bar sits above the bottom navigation */
@media (max-width: 900px) {
  .sig-decide__bar {
    position: sticky; bottom: calc(var(--bottom-nav-h, 58px) + env(safe-area-inset-bottom));
    margin: 0 calc(-1 * var(--space-4)); padding: var(--space-3) var(--space-4);
    background: var(--surface); border-top: 1px solid var(--line); z-index: 5;
  }
}
@media (max-width: 720px) {
  .sig-head__title { font-size: var(--text-xl); }
  .sig-summary__amount { font-size: var(--text-2xl); }
}

/* ==========================================================================
   Phone home « Aujourd'hui » (T1, erp/_today.html) and module menu (T8,
   erp/menu.html). The home block only shows on a phone; there it replaces
   the module tiles (.home-classic), which tablets and desktops keep.
   ========================================================================== */
.m-today { display: none; }
html.is-phone .m-today { display: flex; }
html.is-phone .m-today ~ .home-classic { display: none; }

.sig-banner {
  display: flex; align-items: center; gap: var(--space-3); min-height: 52px;
  padding: var(--space-3) var(--space-4); border-radius: var(--radius-md);
  background: var(--spruce); color: var(--on-dark); text-decoration: none; font-size: var(--text-sm);
}
.sig-banner b { font-size: var(--text-md); }
.sig-banner__icon { display: flex; color: #ffb4a8; }
.sig-banner__text { flex: 1; min-width: 0; }
.sig-banner--calm { background: var(--brand-tint); color: var(--brand-strong); }
.sig-banner--calm .sig-banner__icon { color: var(--brand); }

.sig-section { display: flex; flex-direction: column; gap: var(--space-2); }
.sig-section__title, .sig-card__title { margin: 0; font-family: var(--font-display); font-size: var(--text-md); font-weight: 600; }
.sig-card__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: var(--space-3) var(--space-4) var(--space-2); }
.sig-card__head .sig-card__title { padding: 0; }
.sig-more { font-size: var(--text-sm); font-weight: 600; color: var(--brand); text-decoration: none; white-space: nowrap; }
.sig-card__empty { margin: 0; padding: var(--space-3) var(--space-4) var(--space-4); font-size: var(--text-sm); color: var(--text-muted); border-top: 1px solid var(--line); }

.sig-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }
.sig-kpi {
  display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: var(--space-3);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); color: var(--text); text-decoration: none;
}
.sig-kpi__label { font-size: var(--text-xs); font-weight: 600; color: var(--text-muted); }
.sig-kpi__value { font-family: var(--font-display); font-size: var(--text-xl); font-weight: 700; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sig-kpi__foot { font-size: var(--text-2xs); color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sig-up { color: var(--ok-fg); }
.sig-down { color: var(--crit-fg); }

/* module menu rows */
.sig-icon { width: 32px; height: 32px; flex-shrink: 0; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; background: var(--surface-sunken); color: var(--text-muted); }
.sig-icon--danger { background: var(--crit-bg); color: var(--crit-fg); }
.sig-count { min-width: 22px; height: 22px; padding: 0 7px; border-radius: var(--radius-pill); background: var(--crit-bg); color: var(--crit-fg); font-size: var(--text-xs); font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.sig-chev { display: flex; color: var(--text-subtle); flex-shrink: 0; }
.sig-row--button { width: 100%; border-inline-start: 0; border-inline-end: 0; border-bottom: 0; background: none; font: inherit; text-align: start; cursor: pointer; }
.sig-row--danger .sig-row__title { color: var(--crit-fg); }
.sig-card > form { margin: 0; }

/* ==========================================================================
   Module board (T2, erp/_module_phone.html) — first element of a module
   overview. On a phone it shows and every following sibling is hidden;
   on anything wider it is never displayed.
   ========================================================================== */
.m-module { display: none; }
html.is-phone .m-module { display: flex; }
html.is-phone .m-module ~ * { display: none !important; }
.sig-warn { color: var(--warn-fg); }
.sig-desk { display: flex; gap: var(--space-2); align-items: center; margin: 0; padding: var(--space-3); border-radius: var(--radius-sm); background: var(--surface-sunken); font-size: var(--text-xs); color: var(--text-muted); }
.sig-desk svg { flex-shrink: 0; }

/* ==========================================================================
   Record card (T6, erp/_record_phone.html) — first element of a record
   page; on a phone it shows and the desktop layout after it is hidden.
   ========================================================================== */
.m-record { display: none; }
html.is-phone .m-record { display: flex; }
html.is-phone .m-record ~ * { display: none !important; }
.sig-party { font-size: var(--text-md); font-weight: 600; }
.sig-contacts { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.sig-amount { font-family: var(--font-display); font-weight: 600; font-size: var(--text-sm); white-space: nowrap; }
