/* PSA additions on top of /styles.css (same tokens, light and dark). */
:root {
  --psa-flow: #2f7cf6;
  --psa-heat-free: var(--surface-2);
  --psa-heat-some: color-mix(in srgb, var(--psa-flow) 18%, var(--surface));
  --psa-heat-busy: color-mix(in srgb, var(--psa-flow) 42%, var(--surface));
  --psa-heat-over: color-mix(in srgb, var(--bad) 30%, var(--surface));
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --psa-flow: #4b93ff;
  }
}
:root[data-theme="dark"] {
  --psa-flow: #4b93ff;
}

.psa-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  align-items: start;
}
.psa-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  border-left: 3px solid var(--border);
}
.psa-alert.bad {
  border-left-color: var(--bad);
}
.psa-alert.warn {
  border-left-color: var(--warn);
}
.psa-alert.info {
  border-left-color: var(--psa-flow);
}
.psa-badge {
  margin-left: auto;
  min-width: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--bad);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  line-height: 18px;
}
.tabs .tab-link {
  font-size: 13.5px;
  padding: 6px 12px;
  color: var(--text-2);
  border-radius: 8px;
  text-decoration: none;
}
.tabs .tab-link.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 550;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* meters */
.psa-meter {
  display: inline-block;
  position: relative;
  width: 100%;
  max-width: 160px;
  height: 6px;
  border-radius: 3px;
  background: var(--surface-2);
  overflow: hidden;
  vertical-align: middle;
}
.psa-meter > span {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--psa-flow);
  border-radius: 3px;
}
.psa-burn {
  min-width: 150px;
}
.psa-burn .psa-meter {
  width: 90px;
  margin-right: 8px;
}

/* my week */
.psa-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin: 4px 0 14px;
}
.psa-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}
.psa-day b {
  color: var(--text);
  font-size: 12.5px;
  min-height: 16px;
}
.psa-day-bar {
  position: relative;
  width: 100%;
  max-width: 34px;
  height: 84px;
  border-radius: 6px;
  background: var(--surface-2);
  overflow: hidden;
}
.psa-day-bar > span {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--psa-flow);
  border-radius: 6px 6px 0 0;
}
.psa-day-bar > i {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px dashed var(--text-2);
  opacity: 0.5;
}
.psa-day-bar > i {
  bottom: 0;
}
.psa-sched {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.psa-sched li {
  display: grid;
  gap: 5px;
}
.psa-sched-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13.5px;
}
.psa-sched .psa-meter {
  max-width: none;
}

/* timesheet */
.psa-weeknav {
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.psa-ts table {
  min-width: 760px;
}
.psa-ts th.weekend,
.psa-ts td.weekend {
  background: color-mix(in srgb, var(--surface-2) 55%, transparent);
}
.psa-cell {
  width: 62px;
  height: 32px;
  text-align: right;
  padding: 4px 8px;
  font-variant-numeric: tabular-nums;
}
.psa-cell::-webkit-inner-spin-button {
  opacity: 0.4;
}
.psa-cell.st-submitted {
  background: color-mix(in srgb, var(--psa-flow) 10%, var(--surface));
}
.psa-cell.st-approved {
  background: var(--good-soft);
}
.psa-cell.st-rejected {
  border-color: var(--bad);
  background: var(--bad-soft);
}
.psa-cell.saving {
  opacity: 0.6;
}
.psa-cell.saved {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--good) 45%, transparent);
}
.psa-cell:disabled {
  color: var(--text);
  opacity: 1;
}
.psa-total td {
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.psa-total b.over {
  color: var(--warn);
}
.psa-addrow {
  margin-top: 12px;
  flex-wrap: wrap;
  gap: 8px;
}
.psa-addrow select {
  min-width: 280px;
}
.psa-addrow input:not([type="checkbox"]) {
  min-width: 160px;
}

/* projects */
.psa-bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 150px;
  padding-top: 6px;
}
.psa-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  height: 100%;
  gap: 4px;
}
.psa-bar > span {
  width: 100%;
  max-width: 28px;
  background: var(--psa-flow);
  border-radius: 4px 4px 0 0;
  opacity: 0.85;
}
.psa-bar > i {
  font-style: normal;
  font-size: 11px;
  color: var(--muted);
}
.psa-tasklist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.psa-tasklist li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px 110px;
  gap: 10px;
  align-items: center;
  font-size: 13.5px;
}
.psa-tasklist .num {
  text-align: right;
}
.psa-inline {
  width: 96px;
  height: 30px;
  text-align: right;
}
.psa-inline-label {
  flex-direction: row;
  align-items: center;
  gap: 10px;
}
.psa-inline-label input {
  width: 110px;
}

/* resources heatmap */
.psa-res table {
  min-width: 720px;
}
.psa-res th.now {
  color: var(--text);
}
.psa-heat {
  width: 100%;
  min-width: 64px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  padding: 6px 8px;
  border: 0;
  border-radius: 8px;
  font: inherit;
  color: var(--text);
  cursor: pointer;
  background: var(--psa-heat-free);
}
.psa-heat b {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.psa-heat span {
  font-size: 11px;
  color: var(--text-2);
  min-height: 13px;
}
.psa-heat.some {
  background: var(--psa-heat-some);
}
.psa-heat.busy {
  background: var(--psa-heat-busy);
}
.psa-heat.over {
  background: var(--psa-heat-over);
}
.psa-heat:hover {
  outline: 2px solid var(--border);
}
.psa-legend {
  margin: 0 0 10px;
}
.psa-legend .sw {
  width: 14px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}
.sw.free {
  background: var(--psa-heat-free);
  border: 1px solid var(--border);
}
.sw.some {
  background: var(--psa-heat-some);
}
.sw.busy {
  background: var(--psa-heat-busy);
}
.sw.over {
  background: var(--psa-heat-over);
}
.lc-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 12.5px;
  color: var(--muted);
}
.lc-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* approvals */
.psa-approval {
  margin-bottom: 12px;
}
.psa-approval h2 {
  display: flex;
  align-items: center;
  gap: 8px;
}
.psa-chips {
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 8px;
}
.psa-entries {
  width: 100%;
  margin-top: 8px;
}
.psa-entries td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}

@media (max-width: 640px) {
  .psa-tasklist li {
    grid-template-columns: 1fr auto;
  }
  .psa-tasklist li .psa-meter {
    grid-column: 1 / -1;
    grid-row: 2;
    max-width: none;
  }
}
.psa-ts td:first-child,
.psa-ts th:first-child {
  min-width: 210px;
}
.psa-res td:first-child,
.psa-res th:first-child {
  min-width: 180px;
}

/* charts */
:root {
  --pc-0: #2f7cf6;
  --pc-1: #7c5cff;
  --pc-2: #16a34a;
  --pc-3: #e0a106;
  --pc-4: #ef5f5f;
  --pc-5: #0ea5b7;
  --pc-muted: #b4bac4;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --pc-0: #4b93ff;
    --pc-1: #9b85ff;
    --pc-2: #22c55e;
    --pc-3: #f5b83d;
    --pc-4: #f96b6b;
    --pc-5: #22c3d6;
    --pc-muted: #5b6270;
  }
}
:root[data-theme="dark"] {
  --pc-0: #4b93ff;
  --pc-1: #9b85ff;
  --pc-2: #22c55e;
  --pc-3: #f5b83d;
  --pc-4: #f96b6b;
  --pc-5: #22c3d6;
  --pc-muted: #5b6270;
}
.pc-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.pc-grid {
  stroke: var(--border);
}
.pc-axis {
  font-size: 11px;
  fill: var(--muted);
}
.pc-axis.strong {
  fill: var(--bad);
  font-weight: 600;
}
.pc-bar {
  transition: opacity 0.15s;
}
.pc-bar:hover {
  opacity: 0.8;
}
.pc-bar.c0,
.pc-dot.c0 {
  fill: var(--pc-0);
}
.pc-bar.c1 {
  fill: var(--pc-1);
}
.pc-bar.c2,
.pc-dot.c2 {
  fill: var(--pc-2);
}
.pc-bar.c3 {
  fill: var(--pc-3);
}
.pc-bar.c4 {
  fill: var(--pc-4);
}
.pc-bar.c5 {
  fill: var(--pc-5);
}
.pc-bar.muted {
  fill: var(--pc-muted);
}
.pc-line {
  fill: none;
  stroke-width: 2.2;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.pc-line.c0 {
  stroke: var(--pc-0);
}
.pc-line.c2 {
  stroke: var(--pc-2);
}
.pc-line.cap {
  stroke: var(--text-2);
  stroke-width: 1.6;
}
.pc-line.dashed {
  stroke-dasharray: 5 4;
}
.pc-dot {
  stroke: var(--surface);
  stroke-width: 1.5;
}
.pc-dot.cap {
  fill: var(--text-2);
}
.pc-area.c0 {
  fill: var(--pc-0);
  fill-opacity: 0.12;
}
.pc-hline {
  stroke: var(--bad);
  stroke-width: 1.5;
  stroke-dasharray: 2 3;
}
.pc-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}
.pc-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.psa-meter.warn > span {
  background: var(--warn);
}
.psa-meter.over > span {
  background: var(--bad);
}
.psa-day.weekend .psa-day-bar > span {
  background: var(--muted);
}
.pc-sw {
  display: inline-block;
  width: 12px;
  height: 8px;
  border-radius: 2px;
  background: var(--pc-muted);
  flex: none;
}
.pc-sw.c0 {
  background: var(--pc-0);
}
.pc-sw.c1 {
  background: var(--pc-1);
}
.pc-sw.c2 {
  background: var(--pc-2);
}
.pc-sw.c3 {
  background: var(--pc-3);
}
.pc-sw.c4 {
  background: var(--pc-4);
}
.pc-sw.c5 {
  background: var(--pc-5);
}
.pc-sw.cap {
  background: none;
  height: 0;
  border-top: 2px dashed var(--text-2);
}
.pc-ring {
  width: 128px;
  flex: none;
}
.pc-ring svg {
  width: 100%;
  height: auto;
  display: block;
}
.pc-ring-bg {
  fill: none;
  stroke: var(--surface-2);
  stroke-width: 12;
}
.pc-ring-fg {
  fill: none;
  stroke: var(--pc-0);
  stroke-width: 12;
  stroke-linecap: round;
}
.pc-ring-fg.good {
  stroke: var(--pc-2);
}
.pc-ring-fg.warn {
  stroke: var(--pc-3);
}
.pc-ring-fg.bad {
  stroke: var(--pc-4);
}
.pc-ring-target {
  stroke: var(--text);
  stroke-width: 2.5;
}
.pc-ring-val {
  font-size: 22px;
  font-weight: 650;
  fill: var(--text);
}
.pc-scatter {
  max-width: 380px;
  margin: 0 auto;
}
.pc-zone.bad {
  fill: var(--bad);
  fill-opacity: 0.06;
}
.pc-diag {
  stroke: var(--text-2);
  stroke-dasharray: 4 4;
}
.pc-pt {
  fill: var(--pc-0);
  fill-opacity: 0.8;
  stroke: var(--surface);
  stroke-width: 2;
  cursor: pointer;
}
.pc-pt.at_risk {
  fill: var(--pc-3);
}
.pc-pt.over {
  fill: var(--pc-4);
}
.pc-pt.on_track {
  fill: var(--pc-2);
}

/* utilisation and people */
.psa-util-body {
  display: flex;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
}
.psa-util-body > div {
  flex: 1;
  min-width: 180px;
}
.psa-mix {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 5px;
  font-size: 13px;
}
.psa-mix li {
  display: flex;
  align-items: center;
  gap: 8px;
}
.psa-mix li .muted {
  margin-left: auto;
}
.psa-away {
  border-top: 1px solid var(--border);
  margin-top: 12px;
  padding-top: 10px;
  display: grid;
  gap: 4px;
}
.psa-people {
  display: grid;
  gap: 14px;
}
.psa-person-top {
  display: flex;
  justify-content: space-between;
  font-size: 13.5px;
  margin-bottom: 5px;
}
.psa-ubar {
  position: relative;
  display: flex;
  height: 10px;
  border-radius: 5px;
  background: var(--surface-2);
  overflow: visible;
  margin-bottom: 4px;
}
.psa-ubar .b {
  background: var(--pc-0);
  border-radius: 5px 0 0 5px;
}
.psa-ubar .o {
  background: var(--pc-muted);
}
.psa-ubar i {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 2px;
  background: var(--text);
  border-radius: 1px;
}
.kpi .value.warn {
  color: var(--warn);
}
.kpi .value.neg,
td.neg {
  color: var(--bad);
}

/* time off and holidays */
.psa-daytag {
  display: inline-block;
  margin-top: 3px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  background: var(--info-soft);
  color: var(--text-2);
}
.psa-daytag.warn {
  background: var(--warn-soft);
  color: var(--warn);
}
.psa-ts th.away {
  background: color-mix(in srgb, var(--pc-1) 8%, var(--surface));
}
.psa-day.away .psa-day-bar {
  background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 4px, transparent 4px, transparent 8px);
}
.psa-heat em {
  font-style: normal;
  font-size: 10.5px;
  color: var(--pc-1);
  font-weight: 600;
}
.psa-hol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
  font-size: 13.5px;
}
.psa-hol li {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px;
}
.psa-hol li.past {
  color: var(--muted);
}
.psa-torow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.psa-util-body > .pc-ring {
  flex: none;
  width: 128px;
  min-width: 0;
}
.psa-receipt {
  max-width: 100%;
  max-height: 70vh;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: block;
  margin: 8px 0 12px;
}
th.sel,
td.sel {
  width: 28px;
  padding-right: 0;
}
