/* pHARe — styles partagés par la fiche du CPE (index.html) et la page du
   destinataire d'un lien (partage.html). Tout est teinté via color-mix() à
   partir des variables de thème : la page qui inclut ce fichier fournit les
   variables (--surface, --text, --accent…) ; le mode sombre suit. */
.ph-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; white-space: nowrap; line-height: 1.3; border: 1px solid var(--border2); color: var(--text2); background: var(--surface2); }
.ph-badge-open { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.ph-badge-share { color: var(--success); background: color-mix(in srgb, var(--success) 12%, transparent); border-color: color-mix(in srgb, var(--success) 35%, transparent); }
.ph-muted { color: var(--text3); font-weight: 400; }

.ph-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.ph-head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ph-btn { padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border2); background: var(--surface); color: var(--text2); font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap; }
.ph-btn:hover { background: var(--surface2); }
.ph-btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.ph-btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.ph-btn-icon { padding: 8px 11px; font-size: 16px; line-height: 1; }
.ph-link { background: none; border: none; color: var(--accent); font: inherit; font-size: 12px; cursor: pointer; padding: 0; }
.ph-link:hover { text-decoration: underline; }

.ph-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.ph-stat { --tone: var(--accent); display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radius); border: 1px solid color-mix(in srgb, var(--tone) 24%, transparent); background: color-mix(in srgb, var(--tone) 8%, var(--surface)); color: var(--text); text-align: left; font: inherit; cursor: pointer; transition: box-shadow .12s, border-color .12s; }
.ph-stat[class*="ph-st-"] { --tone: var(--st); }
.ph-stat:hover { border-color: color-mix(in srgb, var(--tone) 55%, transparent); }
.ph-stat.active { border-color: var(--tone); box-shadow: 0 0 0 1px var(--tone); }
.ph-stat-ico { width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px; color: var(--tone); background: color-mix(in srgb, var(--tone) 18%, transparent); }
.ph-stat-ico svg { width: 19px; height: 19px; }
.ph-stat-txt { display: flex; flex-direction: column; min-width: 0; }
.ph-stat-n { font-family: Georgia, serif; font-size: 26px; line-height: 1.05; }
.ph-stat-l { font-size: 12px; color: var(--text2); }

.ph-filters { padding: 16px 18px; margin-bottom: 16px; }
.ph-filters-t { font-size: 13px; font-weight: 700; margin-bottom: 12px; }
.ph-filters-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.ph-fld { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text2); }
.ph-fld .ph-input { width: 100%; }
.ph-input { padding: 9px 12px; border: 1px solid var(--border2); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; font-size: 13px; min-width: 130px; }
.ph-input:focus { outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 1px; }
.ph-input-search { width: 100%; }

.ph-resbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--text3); margin-bottom: 8px; }
.ph-table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.ph-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.ph-table th { text-align: left; padding: 11px 14px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--text3); background: var(--surface2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; user-select: none; }
.ph-table th.ph-sort { cursor: pointer; }
.ph-table th.ph-sort:hover { color: var(--text); }
.ph-table td { padding: 14px; font-size: 13px; border-top: 1px solid var(--border); vertical-align: middle; overflow: hidden; }
.ph-row { cursor: pointer; }
.ph-row:hover td { background: var(--surface2); }
.ph-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.ph-c-nom { width: 16%; } .ph-c-cl { width: 8%; } .ph-c-st { width: 13%; } .ph-c-de { width: 14%; } .ph-c-le { width: 12%; }
.ph-c-pa { width: 15%; } .ph-c-nb { width: 6.5%; } .ph-c-up { width: 9.5%; } .ph-c-fl { width: 4%; } .ph-c-ch { width: 2%; }
.ph-ellipsis { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ph-nom { font-weight: 600; }
.ph-sub { font-size: 11px; color: var(--text3); margin-top: 2px; }
.ph-flags { display: flex; gap: 4px; font-size: 13px; }
.ph-chev { color: var(--text3); font-size: 18px; text-align: right; }

.ph-banner { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 14px; display: flex; gap: 8px; align-items: flex-start; line-height: 1.5; }
.ph-banner-warn { background: var(--amber-light); border: 1px solid color-mix(in srgb, var(--amber) 45%, transparent); color: var(--amber); }
.ph-banner-clos { background: var(--surface2); border: 1px solid var(--border2); color: var(--text); }

.ph-back { background: none; border: none; color: var(--accent); font: inherit; font-size: 13px; cursor: pointer; padding: 0; margin-bottom: 14px; }
.ph-back:hover { text-decoration: underline; }
.ph-fiche-head { display: flex; gap: 16px; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; margin-bottom: 18px; }
.ph-fiche-title { font-family: Georgia, serif; font-size: 26px; letter-spacing: -.4px; line-height: 1.2; }
.ph-fiche-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.ph-fiche-sub { font-size: 13px; color: var(--text2); margin-top: 8px; }
.ph-grid { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 20px; align-items: start; }
.ph-aside { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 14px; }
.ph-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.ph-card-t { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text3); margin-bottom: 8px; }
.ph-text { font-size: 13px; color: var(--text2); white-space: pre-line; text-align: justify; overflow-wrap: anywhere; line-height: 1.55; }
.ph-pline { font-size: 13px; padding: 2px 0; overflow-wrap: anywhere; }
.ph-tab-syn { display: none; }

.ph-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border2); margin-bottom: 16px; flex-wrap: wrap; }
.ph-tab { padding: 10px 14px; background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -1px; font: inherit; font-size: 13px; color: var(--text2); cursor: pointer; }
.ph-tab:hover { color: var(--text); }
.ph-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.ph-tl-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.ph-seg { display: inline-flex; border: 1px solid var(--border2); border-radius: var(--radius-sm); overflow: hidden; }
.ph-seg button { padding: 6px 12px; background: var(--surface); border: none; font: inherit; font-size: 12px; color: var(--text2); cursor: pointer; }
.ph-seg button + button { border-left: 1px solid var(--border2); }
.ph-seg button.active { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); color: var(--accent); font-weight: 600; }

.ph-tl-item { display: flex; gap: 14px; }
.ph-tl-rail { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; width: 34px; }
.ph-tl-ico { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; color: var(--k, var(--text2)); background: color-mix(in srgb, var(--k, var(--text2)) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--k, var(--text2)) 38%, transparent); }
.ph-tl-line { width: 2px; flex: 1; background: var(--border2); margin: 4px 0; min-height: 14px; }
.ph-tl-item:last-child .ph-tl-line { visibility: hidden; }
.ph-tl-card { flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; box-shadow: var(--shadow); }
.ph-tl-card.ph-tl-soft { background: var(--surface2); box-shadow: none; }
.ph-tl-top { display: flex; gap: 8px; align-items: flex-start; }
.ph-tl-title { font-size: 14px; font-weight: 600; flex: 1; min-width: 0; overflow-wrap: anywhere; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ph-tl-date { font-size: 12px; color: var(--text3); white-space: nowrap; padding-top: 2px; }
.ph-tl-txt { font-size: 13px; color: var(--text2); white-space: pre-line; text-align: justify; overflow-wrap: anywhere; margin-top: 6px; line-height: 1.5; }
.ph-tl-meta { font-size: 12px; color: var(--text2); margin-top: 4px; }
.ph-tl-more { margin-top: 8px; }
.ph-k-entretien { --k: #2563EB; } .ph-k-confrontation { --k: #DB2777; } .ph-k-famille { --k: #0D9488; }
.ph-k-reunion { --k: #64748B; } .ph-k-sanction { --k: #B45309; } .ph-k-signalement { --k: #0E7490; }
.ph-k-commentaire { --k: #64748B; } .ph-k-externe { --k: #4F46E5; } .ph-k-autre { --k: #64748B; }
.ph-k-ouverture { --k: #16A34A; } .ph-k-cloture { --k: #475569; }

.ph-pers { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--border); }
.ph-card-t + .ph-pers { border-top: none; }
.ph-avatar { width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.ph-view-text { font-size: 14px; color: var(--text); white-space: pre-wrap; text-align: justify; overflow-wrap: anywhere; line-height: 1.6; }

@media (max-width: 1100px) { .ph-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 899px) {
  .ph-grid { grid-template-columns: minmax(0, 1fr); }
  .ph-aside { display: none; }
  .ph-tab-syn { display: inline-block; }
}
@media (max-width: 760px) {
  .ph-hide-sm { display: none; }
  .ph-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ph-fiche-title { font-size: 22px; }
}

/* ── pHARe : stades, priorité, à traiter, actions, en-tête logo ── */
.ph-st-a-qualifier { --st: #2563EB; } .ph-st-en-cours { --st: #EA580C; } .ph-st-a-surveiller { --st: #CA8A04; } .ph-st-clos { --st: #16A34A; }
.ph-badge.ph-stade { color: var(--st); background: color-mix(in srgb, var(--st) 14%, transparent); border-color: color-mix(in srgb, var(--st) 40%, transparent); }
.ph-badge-prio { --st: var(--coral); color: var(--st); background: color-mix(in srgb, var(--st) 12%, transparent); border-color: color-mix(in srgb, var(--st) 40%, transparent); }
.ph-badge-btn { font: inherit; font-size: 11px; font-weight: 700; cursor: pointer; }
.ph-badge-btn:hover { filter: brightness(.94); }
.ph-mini { font-size: 10px; padding: 1px 7px; margin-top: 3px; display: inline-flex; }
.ph-stat-s { font-size: 11px; color: var(--text3); }
.ph-stat-txt { gap: 1px; }

.ph-brand { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.ph-logo { height: 52px; width: auto; color: #1A47B8; flex-shrink: 0; }
[data-theme="dark"] .ph-logo { color: #7FA6FF; }
.ph-brand-t { font-size: 15px; font-weight: 600; color: var(--text); }
.ph-brand-s { font-size: 13px; color: var(--text2); margin-top: 2px; letter-spacing: .2px; }

.ph-topgrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; align-items: stretch; }
.ph-topgrid .ph-filters { margin-bottom: 0; }
.ph-today { background: color-mix(in srgb, var(--coral) 7%, var(--surface)); border: 1px solid color-mix(in srgb, var(--coral) 26%, transparent); border-radius: var(--radius); padding: 16px 18px; }
.ph-today-t { font-size: 15px; font-weight: 700; color: var(--coral); margin-bottom: 10px; }
.ph-today-row { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-top: 1px solid color-mix(in srgb, var(--coral) 14%, transparent); cursor: pointer; font-size: 13px; border-radius: 6px; }
.ph-today-row:first-of-type { border-top: none; }
.ph-today-row:hover { background: color-mix(in srgb, var(--coral) 8%, transparent); }
.ph-today-who { font-weight: 600; white-space: nowrap; }
.ph-today-act { flex: 1; min-width: 0; color: var(--text2); }
.ph-today-empty { font-size: 13px; color: var(--text2); padding: 4px 0; }
.ph-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--st); flex-shrink: 0; }
.ph-due-pill { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 6px; white-space: nowrap; color: var(--text2); background: var(--surface2); }
.ph-due-pill.ph-due-today, .ph-due-pill.ph-due-late { color: var(--coral); background: color-mix(in srgb, var(--coral) 14%, transparent); }
.ph-due { font-size: 11px; font-weight: 600; color: var(--text3); white-space: nowrap; }
.ph-due-late { color: var(--coral); }
.ph-due-today { color: var(--accent); }
.ph-sub.ph-due-late { color: var(--coral); font-weight: 600; }
.ph-sub.ph-due-today { color: var(--accent); font-weight: 600; }

.ph-act { display: flex; align-items: flex-start; gap: 9px; padding: 7px 0; border-top: 1px solid var(--border); }
.ph-card-t + .ph-act { border-top: none; }
.ph-act input { margin-top: 3px; accent-color: var(--accent); cursor: pointer; }
.ph-act-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ph-act-t { font-size: 13px; color: var(--text); overflow-wrap: anywhere; cursor: pointer; }
.ph-act.done .ph-act-t { text-decoration: line-through; color: var(--text3); }
.ph-act-x { background: none; border: none; color: var(--text3); font-size: 17px; line-height: 1; cursor: pointer; padding: 0 2px; }
.ph-act-x:hover { color: var(--coral); }

@media (max-width: 899px) { .ph-topgrid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 520px) { .ph-filters-row { grid-template-columns: minmax(0, 1fr); } .ph-logo { height: 44px; } }
