/* =====================================================================
   Project Control System — application styles
   Layered on top of Bootstrap 5.3. Guide s.29: consistent hierarchy,
   red/amber/green used sparingly and only for health and exceptions.
   ===================================================================== */

:root {
  --pcs-sidebar-width: 244px;
  --pcs-topbar-height: 56px;

  --pcs-bg: #f6f7f9;
  --pcs-surface: #ffffff;
  --pcs-border: #e3e6ea;
  --pcs-border-strong: #ced4da;
  --pcs-text: #1d2125;
  --pcs-text-muted: #6b7280;
  --pcs-text-faint: #9aa1a9;

  --pcs-sidebar-bg: #16202c;
  --pcs-sidebar-text: #b3c0cf;
  --pcs-sidebar-hover: #1f2c3b;
  --pcs-sidebar-active: #2563eb;

  --pcs-green: #198754;
  --pcs-amber: #fd7e14;
  --pcs-red: #dc3545;
  --pcs-blue: #0d6efd;

  --pcs-radius: 8px;
  --pcs-radius-sm: 5px;
  --pcs-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .04);
  --pcs-shadow-lg: 0 4px 16px rgba(16, 24, 40, .10);
}

/* ---------- Shell ---------- */

.pcs-body {
  background: var(--pcs-bg);
  color: var(--pcs-text);
  font-size: .9rem;
  -webkit-font-smoothing: antialiased;
}

.pcs-skip {
  position: absolute; top: .5rem; left: .5rem; z-index: 2000;
  background: #fff; padding: .5rem .75rem; border-radius: var(--pcs-radius-sm);
}

.pcs-shell {
  margin-left: var(--pcs-sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.pcs-main {
  flex: 1;
  padding: 1.25rem 1.5rem 2rem;
  max-width: 1680px;
  width: 100%;
}

.pcs-footer {
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: 1rem 1.5rem; border-top: 1px solid var(--pcs-border);
  font-size: .78rem; color: var(--pcs-text-muted);
}

/* ---------- Sidebar ---------- */

.pcs-sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--pcs-sidebar-width);
  background: var(--pcs-sidebar-bg); color: var(--pcs-sidebar-text);
  display: flex; flex-direction: column; z-index: 1040;
}

.pcs-brand {
  display: flex; align-items: center; gap: .6rem;
  padding: .85rem 1rem; text-decoration: none; color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
  min-height: var(--pcs-topbar-height);
}
.pcs-brand-mark {
  display: grid; place-items: center; width: 30px; height: 30px; flex: 0 0 30px;
  background: var(--pcs-sidebar-active); border-radius: 7px;
  font-weight: 700; font-size: .68rem; letter-spacing: .02em;
}
.pcs-brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.pcs-brand-text strong { font-size: .85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcs-brand-text em { font-style: normal; font-size: .7rem; color: #7d8ea3; }

.pcs-nav-scroll { flex: 1; overflow-y: auto; padding: .75rem .6rem 2rem; }
.pcs-nav-scroll::-webkit-scrollbar { width: 6px; }
.pcs-nav-scroll::-webkit-scrollbar-thumb { background: #2c3a4b; border-radius: 3px; }

.pcs-nav { list-style: none; margin: 0 0 .25rem; padding: 0; }

.pcs-nav-heading {
  margin: 1rem .5rem .35rem; font-size: .66rem; font-weight: 700;
  letter-spacing: .09em; text-transform: uppercase; color: #64748b;
}

.pcs-nav-link {
  display: flex; align-items: center; gap: .55rem;
  padding: .42rem .6rem; margin-bottom: 1px;
  color: var(--pcs-sidebar-text); text-decoration: none;
  border-radius: var(--pcs-radius-sm); font-size: .83rem;
  transition: background .12s ease, color .12s ease;
}
.pcs-nav-link:hover { background: var(--pcs-sidebar-hover); color: #fff; }
.pcs-nav-link.active { background: var(--pcs-sidebar-active); color: #fff; font-weight: 500; }
.pcs-nav-icon { width: 1.1rem; text-align: center; opacity: .8; font-size: .8rem; }
.pcs-nav-sub { padding-left: 2.2rem; font-size: .79rem; color: #8896a8; }
.pcs-nav-sub:hover { color: #fff; }

.pcs-dept-dot {
  width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px;
  margin-left: -1.05rem; margin-right: .35rem;
}

.pcs-sidebar-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 1035;
}

/* ---------- Top bar ---------- */

.pcs-topbar {
  position: sticky; top: 0; z-index: 1020;
  display: flex; align-items: center; gap: .75rem;
  height: var(--pcs-topbar-height); padding: 0 1.5rem;
  background: var(--pcs-surface); border-bottom: 1px solid var(--pcs-border);
}

.pcs-search { position: relative; flex: 1; max-width: 460px; }
.pcs-search .form-control { padding-left: 2.1rem; height: 34px; font-size: .85rem; background: var(--pcs-bg); border-color: transparent; }
.pcs-search .form-control:focus { background: #fff; border-color: var(--pcs-blue); box-shadow: none; }
.pcs-search-icon { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--pcs-text-faint); pointer-events: none; }

.pcs-search-results {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 1050;
  background: #fff; border: 1px solid var(--pcs-border); border-radius: var(--pcs-radius);
  box-shadow: var(--pcs-shadow-lg); max-height: 26rem; overflow-y: auto; padding: .25rem;
}
.pcs-search-group { font-size: .66rem; text-transform: uppercase; letter-spacing: .07em; color: var(--pcs-text-faint); padding: .5rem .6rem .2rem; font-weight: 700; }
.pcs-search-item { display: flex; align-items: center; gap: .5rem; padding: .4rem .6rem; border-radius: var(--pcs-radius-sm); text-decoration: none; color: var(--pcs-text); }
.pcs-search-item:hover, .pcs-search-item:focus { background: var(--pcs-bg); }
.pcs-search-item .ctx { margin-left: auto; font-size: .74rem; color: var(--pcs-text-muted); }

.pcs-topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .5rem; }

.pcs-icon-btn {
  position: relative; display: grid; place-items: center; width: 34px; height: 34px;
  border-radius: var(--pcs-radius-sm); color: var(--pcs-text-muted); text-decoration: none;
}
.pcs-icon-btn:hover { background: var(--pcs-bg); color: var(--pcs-text); }

.pcs-badge-count {
  position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px;
  padding: 0 4px; border-radius: 8px; background: var(--pcs-red); color: #fff;
  font-size: .62rem; font-weight: 700; display: grid; place-items: center;
}

.pcs-user-btn {
  display: flex; align-items: center; gap: .5rem; background: none; border: 0;
  padding: .25rem .4rem; border-radius: var(--pcs-radius-sm);
}
.pcs-user-btn:hover { background: var(--pcs-bg); }
.pcs-user-meta { display: flex; flex-direction: column; line-height: 1.2; text-align: left; }
.pcs-user-name { font-size: .8rem; font-weight: 600; }
.pcs-user-role { font-size: .68rem; color: var(--pcs-text-muted); }

.pcs-menu-toggle { color: var(--pcs-text-muted); padding: .25rem .4rem; }

/* ---------- Page header ---------- */

.pcs-page-head {
  display: flex; align-items: flex-start; gap: 1rem; flex-wrap: wrap;
  margin-bottom: 1.1rem;
}
.pcs-page-title { font-size: 1.35rem; font-weight: 650; margin: 0; letter-spacing: -.01em; }
.pcs-page-sub { margin: .2rem 0 0; color: var(--pcs-text-muted); font-size: .84rem; max-width: 68ch; }
.pcs-page-actions { margin-left: auto; display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }

.pcs-breadcrumb { font-size: .78rem; color: var(--pcs-text-muted); margin-bottom: .3rem; }
.pcs-breadcrumb a { color: var(--pcs-text-muted); text-decoration: none; }
.pcs-breadcrumb a:hover { color: var(--pcs-blue); text-decoration: underline; }
.pcs-breadcrumb span + span::before { content: "›"; margin: 0 .4rem; color: var(--pcs-text-faint); }

/* ---------- Cards, panels ---------- */

.pcs-card {
  background: var(--pcs-surface); border: 1px solid var(--pcs-border);
  border-radius: var(--pcs-radius); box-shadow: var(--pcs-shadow);
}
.pcs-card-head {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  padding: .7rem .9rem; border-bottom: 1px solid var(--pcs-border);
}
.pcs-card-title { font-size: .84rem; font-weight: 650; margin: 0; }
.pcs-card-head .pcs-card-actions { margin-left: auto; display: flex; gap: .35rem; align-items: center; }
.pcs-card-body { padding: .9rem; }
.pcs-card-body.p-0 { padding: 0; }

/* ---------- KPI tiles ---------- */

.pcs-kpi-grid {
  display: grid; gap: .75rem; margin-bottom: 1.1rem;
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
}
.pcs-kpi {
  background: var(--pcs-surface); border: 1px solid var(--pcs-border);
  border-radius: var(--pcs-radius); padding: .8rem .9rem;
  text-decoration: none; color: inherit; display: block;
  border-left: 3px solid var(--pcs-border-strong);
  transition: box-shadow .12s ease, transform .12s ease;
}
a.pcs-kpi:hover { box-shadow: var(--pcs-shadow-lg); transform: translateY(-1px); }
.pcs-kpi-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--pcs-text-muted); font-weight: 650; }
.pcs-kpi-value { font-size: 1.6rem; font-weight: 650; line-height: 1.15; margin-top: .15rem; letter-spacing: -.02em; }
.pcs-kpi-hint { font-size: .74rem; color: var(--pcs-text-muted); }
.pcs-kpi--green { border-left-color: var(--pcs-green); }
.pcs-kpi--amber { border-left-color: var(--pcs-amber); }
.pcs-kpi--red   { border-left-color: var(--pcs-red); }
.pcs-kpi--blue  { border-left-color: var(--pcs-blue); }
.pcs-kpi--red .pcs-kpi-value   { color: var(--pcs-red); }
.pcs-kpi--amber .pcs-kpi-value { color: #b45309; }

/* ---------- Badges, health ---------- */

.pcs-badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .13rem .48rem; border-radius: 20px; font-size: .72rem; font-weight: 600;
  color: var(--badge-color, #6c757d);
  background: color-mix(in srgb, var(--badge-color, #6c757d) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--badge-color, #6c757d) 28%, transparent);
  white-space: nowrap;
}

.pcs-health { display: inline-flex; align-items: center; gap: .35rem; font-size: .78rem; font-weight: 550; white-space: nowrap; }
.pcs-health-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; }
.pcs-health-red   { color: var(--pcs-red); }
.pcs-health-amber { color: #b45309; }
.pcs-health-green { color: var(--pcs-green); }
.pcs-health-unknown { color: var(--pcs-text-faint); }

.pcs-chip {
  display: inline-flex; align-items: center; gap: .3rem; padding: .1rem .45rem;
  border-radius: var(--pcs-radius-sm); background: var(--pcs-bg);
  border: 1px solid var(--pcs-border); font-size: .72rem; color: var(--pcs-text-muted);
}

.pcs-critical-flag { color: var(--pcs-red); font-weight: 700; font-size: .68rem; letter-spacing: .04em; }

/* ---------- Avatars ---------- */

.pcs-avatar {
  display: inline-grid; place-items: center; border-radius: 50%;
  background: hsl(var(--avatar-hue, 210) 55% 92%);
  color: hsl(var(--avatar-hue, 210) 55% 30%);
  font-weight: 650; letter-spacing: .01em; flex: 0 0 auto;
}
.pcs-avatar-sm { width: 26px; height: 26px; font-size: .66rem; }
.pcs-avatar-md { width: 34px; height: 34px; font-size: .78rem; }
.pcs-avatar-lg { width: 52px; height: 52px; font-size: 1.05rem; }
.pcs-avatar-stack { display: inline-flex; }
.pcs-avatar-stack .pcs-avatar + .pcs-avatar { margin-left: -8px; border: 2px solid #fff; }

/* ---------- Tables ---------- */

.pcs-table-wrap { overflow-x: auto; }
.pcs-table { width: 100%; margin: 0; font-size: .83rem; border-collapse: separate; border-spacing: 0; }
.pcs-table thead th {
  position: sticky; top: 0; z-index: 2;
  background: #fbfcfd; border-bottom: 1px solid var(--pcs-border);
  padding: .5rem .7rem; text-align: left; white-space: nowrap;
  font-size: .7rem; text-transform: uppercase; letter-spacing: .05em;
  font-weight: 700; color: var(--pcs-text-muted);
}
.pcs-table tbody td { padding: .55rem .7rem; border-bottom: 1px solid #f0f2f4; vertical-align: middle; }
.pcs-table tbody tr:last-child td { border-bottom: 0; }
.pcs-table tbody tr:hover { background: #fafbfc; }
.pcs-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.pcs-table .nowrap { white-space: nowrap; }
.pcs-table a { color: var(--pcs-text); text-decoration: none; font-weight: 550; }
.pcs-table a:hover { color: var(--pcs-blue); text-decoration: underline; }
.pcs-table tr.is-overdue td:first-child { box-shadow: inset 3px 0 0 var(--pcs-red); }
.pcs-table tr.is-critical td:first-child { box-shadow: inset 3px 0 0 var(--pcs-amber); }

.pcs-sort-link { color: inherit !important; text-decoration: none; }
.pcs-sort { font-size: .55rem; vertical-align: middle; color: var(--pcs-blue); }

.pcs-subtle { color: var(--pcs-text-muted); font-size: .76rem; }
.pcs-mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .78rem; }

/* ---------- Progress ---------- */

.pcs-progress { height: 6px; border-radius: 3px; background: #eceff2; min-width: 60px; }
.pcs-progress.sm { height: 4px; }
.pcs-progress-cell { display: flex; align-items: center; gap: .45rem; }
.pcs-progress-cell .pct { font-size: .74rem; color: var(--pcs-text-muted); min-width: 2.4rem; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Filter bar ---------- */

.pcs-filters {
  background: var(--pcs-surface); border: 1px solid var(--pcs-border);
  border-radius: var(--pcs-radius); padding: .7rem .8rem; margin-bottom: 1rem;
}
.pcs-filter-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: flex-end; }
.pcs-filter-field { display: flex; flex-direction: column; gap: .2rem; min-width: 140px; }
.pcs-filter-field label { font-size: .68rem; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--pcs-text-muted); }
.pcs-filter-field .form-select, .pcs-filter-field .form-control { font-size: .82rem; padding: .3rem .5rem; height: 32px; }

.pcs-quick-filters { display: flex; gap: .35rem; flex-wrap: wrap; margin-bottom: .8rem; }
.pcs-quick-filter {
  padding: .25rem .6rem; border-radius: 20px; font-size: .76rem; text-decoration: none;
  border: 1px solid var(--pcs-border); background: #fff; color: var(--pcs-text-muted);
}
.pcs-quick-filter:hover { border-color: var(--pcs-border-strong); color: var(--pcs-text); }
.pcs-quick-filter.active { background: var(--pcs-text); border-color: var(--pcs-text); color: #fff; font-weight: 550; }

/* Multi-select department picker */
.pcs-dept-picker { display: flex; flex-wrap: wrap; gap: .3rem; }
.pcs-dept-option { position: relative; }
.pcs-dept-option input { position: absolute; opacity: 0; pointer-events: none; }
.pcs-dept-option span {
  display: inline-flex; align-items: center; gap: .35rem; cursor: pointer;
  padding: .25rem .55rem; border-radius: 20px; font-size: .76rem;
  border: 1px solid var(--pcs-border); background: #fff; color: var(--pcs-text-muted);
}
.pcs-dept-option input:checked + span { background: var(--dept-color, #0d6efd); border-color: var(--dept-color, #0d6efd); color: #fff; }
.pcs-dept-option input:focus-visible + span { outline: 2px solid var(--pcs-blue); outline-offset: 2px; }

/* ---------- Tabs ---------- */

.pcs-tabs {
  display: flex; gap: .1rem; overflow-x: auto; margin-bottom: 1rem;
  border-bottom: 1px solid var(--pcs-border);
}
.pcs-tab {
  padding: .5rem .75rem; font-size: .82rem; text-decoration: none; white-space: nowrap;
  color: var(--pcs-text-muted); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.pcs-tab:hover { color: var(--pcs-text); }
.pcs-tab.active { color: var(--pcs-blue); border-bottom-color: var(--pcs-blue); font-weight: 600; }
.pcs-tab .count {
  display: inline-block; margin-left: .3rem; padding: 0 .3rem; border-radius: 8px;
  background: var(--pcs-bg); font-size: .68rem; color: var(--pcs-text-muted);
}
.pcs-tab.active .count { background: #e7f0ff; color: var(--pcs-blue); }

/* ---------- Project header ---------- */

.pcs-project-head {
  background: var(--pcs-surface); border: 1px solid var(--pcs-border);
  border-radius: var(--pcs-radius); padding: .9rem 1rem; margin-bottom: 1rem;
  border-left: 4px solid var(--dept-color, #0d6efd);
}
.pcs-project-meta { display: flex; gap: 1.4rem; flex-wrap: wrap; margin-top: .7rem; }
.pcs-project-meta > div { min-width: 100px; }
.pcs-project-meta dt { font-size: .67rem; text-transform: uppercase; letter-spacing: .05em; color: var(--pcs-text-muted); font-weight: 650; }
.pcs-project-meta dd { margin: .1rem 0 0; font-size: .84rem; font-weight: 550; }

/* ---------- Attention list ---------- */

.pcs-attention { list-style: none; margin: 0; padding: 0; }
.pcs-attention li { display: flex; gap: .65rem; padding: .55rem .9rem; border-bottom: 1px solid #f0f2f4; align-items: flex-start; }
.pcs-attention li:last-child { border-bottom: 0; }
.pcs-attention .marker { width: 4px; align-self: stretch; border-radius: 2px; flex: 0 0 4px; }
.pcs-attention .marker-5, .pcs-attention .marker-4 { background: var(--pcs-red); }
.pcs-attention .marker-3 { background: var(--pcs-amber); }
.pcs-attention .marker-2, .pcs-attention .marker-1 { background: var(--pcs-border-strong); }
.pcs-attention .body { flex: 1; min-width: 0; }
.pcs-attention .title { font-weight: 550; font-size: .84rem; display: block; color: var(--pcs-text); text-decoration: none; }
.pcs-attention .title:hover { color: var(--pcs-blue); text-decoration: underline; }
.pcs-attention .meta { font-size: .74rem; color: var(--pcs-text-muted); }
.pcs-attention .late { color: var(--pcs-red); font-weight: 650; font-size: .74rem; white-space: nowrap; }

/* ---------- Timeline / activity ---------- */

.pcs-timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.pcs-timeline::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 1px; background: var(--pcs-border); }
.pcs-timeline li { position: relative; padding: .45rem 0 .45rem 1.6rem; }
.pcs-timeline li::before {
  content: ""; position: absolute; left: 3px; top: .8rem; width: 9px; height: 9px;
  border-radius: 50%; background: #fff; border: 2px solid var(--pcs-border-strong);
}
.pcs-timeline .when { font-size: .72rem; color: var(--pcs-text-faint); }
.pcs-timeline .what { font-size: .82rem; }
.pcs-timeline .who { font-weight: 600; }
.pcs-change-list { list-style: none; margin: .25rem 0 0; padding: 0; font-size: .76rem; color: var(--pcs-text-muted); }
.pcs-change-list li { padding: 0; }
.pcs-change-list li::before { display: none; }
.pcs-change-from { text-decoration: line-through; opacity: .7; }
.pcs-change-to { font-weight: 600; color: var(--pcs-text); }

/* ---------- WBS tree ---------- */

.pcs-wbs { list-style: none; margin: 0; padding: 0; }
.pcs-wbs ul { list-style: none; margin: 0; padding-left: 1.35rem; border-left: 1px dashed var(--pcs-border); }
.pcs-wbs-node {
  display: flex; align-items: center; gap: .6rem; padding: .45rem .6rem;
  border-radius: var(--pcs-radius-sm); border: 1px solid transparent;
}
.pcs-wbs-node:hover { background: #fafbfc; border-color: var(--pcs-border); }
.pcs-wbs-code { font-family: ui-monospace, monospace; font-size: .75rem; color: var(--pcs-text-muted); min-width: 3.2rem; }
.pcs-wbs-name { font-weight: 550; }
.pcs-wbs-type { font-size: .66rem; text-transform: uppercase; letter-spacing: .05em; color: var(--pcs-text-faint); }
.pcs-wbs-actions { margin-left: auto; display: flex; gap: .2rem; opacity: 0; transition: opacity .12s; }
.pcs-wbs-node:hover .pcs-wbs-actions { opacity: 1; }

/* ---------- Gantt ---------- */

.pcs-gantt-wrap {
  border: 1px solid var(--pcs-border); border-radius: var(--pcs-radius);
  background: #fff; overflow: hidden;
}
.pcs-gantt-toolbar {
  display: flex; gap: .5rem; align-items: center; flex-wrap: wrap;
  padding: .55rem .8rem; border-bottom: 1px solid var(--pcs-border); background: #fbfcfd;
}
.pcs-gantt-scroll { overflow: auto; max-height: 72vh; }
.pcs-gantt svg { display: block; }
.pcs-gantt-legend { display: flex; gap: .9rem; flex-wrap: wrap; padding: .5rem .8rem; border-top: 1px solid var(--pcs-border); font-size: .74rem; color: var(--pcs-text-muted); }
.pcs-gantt-legend i { display: inline-block; width: 14px; height: 8px; border-radius: 2px; margin-right: .3rem; vertical-align: middle; }

.pcs-gantt-tooltip {
  position: fixed; z-index: 1080; pointer-events: none;
  background: #16202c; color: #fff; padding: .45rem .6rem; border-radius: var(--pcs-radius-sm);
  font-size: .75rem; line-height: 1.45; box-shadow: var(--pcs-shadow-lg); max-width: 18rem;
}
.pcs-gantt-tooltip b { color: #fff; }
.pcs-gantt-tooltip .dim { color: #93a3b5; }

/* ---------- Empty states (Guide s.29) ---------- */

.pcs-empty { text-align: center; padding: 2.4rem 1rem; color: var(--pcs-text-muted); }
.pcs-empty-icon { font-size: 1.9rem; opacity: .28; margin-bottom: .4rem; }
.pcs-empty-title { font-weight: 600; color: var(--pcs-text); margin-bottom: .25rem; font-size: .92rem; }
.pcs-empty-text { font-size: .83rem; max-width: 42ch; margin: 0 auto .9rem; }

/* ---------- Forms ---------- */

.pcs-form-section { margin-bottom: 1.1rem; }
.pcs-form-section-head { padding-bottom: .4rem; margin-bottom: .8rem; border-bottom: 1px solid var(--pcs-border); }
.pcs-form-section-title { font-size: .88rem; font-weight: 650; margin: 0; }
.pcs-form-section-hint { font-size: .78rem; color: var(--pcs-text-muted); margin: .15rem 0 0; }
.form-label { font-size: .78rem; font-weight: 600; margin-bottom: .2rem; }
.form-text { font-size: .74rem; }
.form-control, .form-select { font-size: .85rem; }
.pcs-required::after { content: " *"; color: var(--pcs-red); }

.pcs-form-actions {
  position: sticky; bottom: 0; background: var(--pcs-surface);
  border-top: 1px solid var(--pcs-border); padding: .7rem .9rem;
  display: flex; gap: .5rem; justify-content: flex-end; align-items: center;
  border-radius: 0 0 var(--pcs-radius) var(--pcs-radius);
}

/* ---------- Health matrix ---------- */

.pcs-health-grid { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.pcs-health-cell { border: 1px solid var(--pcs-border); border-radius: var(--pcs-radius-sm); padding: .55rem .65rem; }
.pcs-health-cell .dim { font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--pcs-text-muted); font-weight: 650; }
.pcs-health-cell .reason { font-size: .74rem; color: var(--pcs-text-muted); margin-top: .25rem; }
.pcs-health-cell.is-red   { border-left: 3px solid var(--pcs-red); }
.pcs-health-cell.is-amber { border-left: 3px solid var(--pcs-amber); }
.pcs-health-cell.is-green { border-left: 3px solid var(--pcs-green); }
.pcs-health-cell.is-unknown { border-left: 3px solid var(--pcs-border-strong); }

/* ---------- Delay analysis bar ---------- */

.pcs-delay-bar { display: flex; height: 26px; border-radius: var(--pcs-radius-sm); overflow: hidden; border: 1px solid var(--pcs-border); }
.pcs-delay-seg { display: grid; place-items: center; font-size: .7rem; color: #fff; font-weight: 600; min-width: 2px; }
.pcs-delay-seg.unattributed { background: repeating-linear-gradient(45deg, #adb5bd, #adb5bd 5px, #9aa1a9 5px, #9aa1a9 10px); }

/* ---------- Matrix (risk P x I) ---------- */

.pcs-matrix { border-collapse: separate; border-spacing: 2px; font-size: .74rem; }
.pcs-matrix td { width: 46px; height: 34px; text-align: center; border-radius: 3px; font-weight: 600; }
.pcs-matrix th { font-size: .66rem; color: var(--pcs-text-muted); font-weight: 650; padding: .2rem; }

/* ---------- Misc ---------- */

.pcs-stat-row { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.pcs-stat { min-width: 92px; }
.pcs-stat .label { font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--pcs-text-muted); font-weight: 650; }
.pcs-stat .value { font-size: 1.05rem; font-weight: 650; }

.pcs-flash-stack .alert { font-size: .85rem; padding: .6rem .9rem; }
.pcs-dl-inline dt { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--pcs-text-muted); font-weight: 650; }
.pcs-dl-inline dd { margin: 0 0 .7rem; font-size: .85rem; }

.pcs-comment { display: flex; gap: .6rem; padding: .55rem 0; border-bottom: 1px solid #f0f2f4; }
.pcs-comment:last-child { border-bottom: 0; }
.pcs-comment .body { flex: 1; }
.pcs-comment .head { display: flex; gap: .5rem; align-items: baseline; }
.pcs-comment .name { font-weight: 600; font-size: .82rem; }
.pcs-comment .time { font-size: .72rem; color: var(--pcs-text-faint); }
.pcs-comment .text { font-size: .84rem; white-space: pre-wrap; margin-top: .1rem; }

.pcs-dept-bar { height: 5px; border-radius: 3px; display: flex; overflow: hidden; background: #eceff2; }
.pcs-dept-bar i { display: block; height: 100%; }

.pcs-table-scroll-hint { font-size: .72rem; color: var(--pcs-text-faint); padding: .3rem .7rem; }

.btn-sm { font-size: .78rem; padding: .22rem .55rem; }
.btn { font-size: .84rem; }

/* ---------- Auth pages ---------- */

.pcs-auth {
  min-height: 100vh; display: grid; place-items: center;
  background: linear-gradient(160deg, #16202c 0%, #1f3350 100%); padding: 1.5rem;
}
.pcs-auth-card {
  width: 100%; max-width: 400px; background: #fff;
  border-radius: 12px; box-shadow: 0 12px 40px rgba(0, 0, 0, .28); padding: 1.9rem 1.7rem;
}
.pcs-auth-brand { display: flex; align-items: center; gap: .6rem; margin-bottom: 1.3rem; }
.pcs-auth-brand .mark { width: 36px; height: 36px; border-radius: 9px; background: var(--pcs-blue); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .78rem; }
.pcs-auth-title { font-size: 1.1rem; font-weight: 650; margin: 0; }
.pcs-auth-sub { font-size: .8rem; color: var(--pcs-text-muted); margin: .1rem 0 0; }
.pcs-auth-foot { margin-top: 1.1rem; font-size: .78rem; text-align: center; color: var(--pcs-text-muted); }

/* ---------- Responsive ---------- */

@media (max-width: 991.98px) {
  .pcs-shell { margin-left: 0; }
  .pcs-sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  .pcs-sidebar.is-open { transform: translateX(0); box-shadow: var(--pcs-shadow-lg); }
  .pcs-topbar { padding: 0 1rem; }
  .pcs-main { padding: 1rem; }
}

@media (max-width: 575.98px) {
  .pcs-kpi-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .pcs-page-actions { width: 100%; }
  .pcs-search { max-width: none; }
}

@media print {
  .pcs-sidebar, .pcs-topbar, .pcs-footer, .pcs-page-actions, .pcs-filters, .pcs-quick-filters { display: none !important; }
  .pcs-shell { margin-left: 0; }
  .pcs-card { break-inside: avoid; border-color: #ccc; box-shadow: none; }
  .pcs-table thead th { position: static; }
}
