.ict-page .ict-ctrl { margin-bottom: 0.75rem; }
.ict-hint {
  margin: 0.35rem 0 0;
  color: rgba(243, 239, 230, 0.55);
  font-size: 0.78rem;
}
.ict-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  margin: 0 0 0.85rem;
  font-size: 0.75rem;
  color: rgba(243, 239, 230, 0.7);
}
.ict-swatch {
  display: inline-block;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 3px;
  margin-right: 0.3rem;
  vertical-align: -2px;
  border: 1px solid rgba(196, 163, 90, 0.25);
}
.ict-swatch.is-empty { background: rgba(8, 18, 13, 0.5); opacity: 0.5; }
.ict-swatch.is-red { background: rgba(185, 70, 70, 0.75); }
.ict-swatch.is-orange { background: rgba(196, 120, 50, 0.75); }
.ict-swatch.is-green { background: rgba(70, 150, 100, 0.85); }

.ict-mode-toggle {
  display: inline-flex;
  gap: 0.25rem;
  align-items: center;
  padding: 0.15rem;
  border: 1px solid rgba(196, 163, 90, 0.28);
  border-radius: 8px;
  background: rgba(8, 18, 13, 0.45);
}
.ict-mode-toggle .er-tbtn {
  min-width: 4.5rem;
  justify-content: center;
}
.ict-zoom-toggle {
  display: inline-flex;
  gap: 0.2rem;
  align-items: center;
  padding: 0.15rem;
  border: 1px solid rgba(196, 163, 90, 0.28);
  border-radius: 8px;
  background: rgba(8, 18, 13, 0.45);
}
.ict-zoom-toggle .er-tbtn {
  min-width: 2rem;
  justify-content: center;
  padding-left: 0.45rem;
  padding-right: 0.45rem;
}
.ict-zoom-label {
  min-width: 2.8rem;
  text-align: center;
  font-size: 0.72rem;
  font-family: var(--er-t-mono);
  color: #e8d5a3;
}

.ict-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
}
.ict-kpi {
  background: rgba(14, 26, 20, 0.9);
  border: 1px solid rgba(196, 163, 90, 0.22);
  border-radius: 10px;
  padding: 0.75rem 0.85rem;
}
.ict-kpi .k { display: block; font-size: 0.7rem; color: rgba(243, 239, 230, 0.55); text-transform: uppercase; letter-spacing: 0.04em; }
.ict-kpi .v { display: block; font-size: 1.35rem; font-weight: 700; color: #e8d5a3; font-family: var(--er-t-mono); }
.ict-kpi .s { display: block; font-size: 0.72rem; color: rgba(243, 239, 230, 0.55); margin-top: 0.15rem; }

.ict-user-card {
  background: rgba(14, 26, 20, 0.92);
  border: 1px solid rgba(196, 163, 90, 0.22);
  border-radius: 12px;
  padding: 0.85rem 0.9rem 1rem;
  margin-bottom: 1rem;
}
.ict-user-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1rem;
  align-items: baseline;
  margin-bottom: 0.65rem;
}
.ict-user-head h3 { margin: 0; font-size: 1.05rem; }
.ict-user-head code { font-size: 0.78rem; color: #c4a35a; }
.ict-user-head a { color: #c4a35a; font-size: 0.8rem; text-decoration: none; }
.ict-user-head a:hover { text-decoration: underline; }
.ict-axis {
  margin: 0;
  font-size: 0.72rem;
  color: rgba(243, 239, 230, 0.55);
}

.ict-matrix-wrap {
  overflow: auto;
  max-height: min(72vh, 820px);
  border: 1px solid rgba(196, 163, 90, 0.18);
  border-radius: 8px;
  background: rgba(8, 18, 13, 0.55);
  position: relative;
}
.ict-matrix-scaler {
  transform-origin: top left;
  width: max-content;
}
.ict-matrix {
  border-collapse: separate;
  border-spacing: 0;
  width: max-content;
  min-width: 100%;
  font-family: var(--er-t-mono);
  font-size: 0.68rem;
}

/* Fit-to-screen: matrix scales into remaining viewport */
body.ict-fit-on .ict-kpis {
  gap: 0.4rem;
  margin-bottom: 0.55rem;
}
body.ict-fit-on .ict-kpi {
  padding: 0.45rem 0.65rem;
}
body.ict-fit-on .ict-kpi .v { font-size: 1.05rem; }
body.ict-fit-on .ict-legend { margin-bottom: 0.45rem; }
body.ict-fit-on .ict-user-card {
  padding: 0.55rem 0.65rem 0.7rem;
  margin-bottom: 0.55rem;
}
body.ict-fit-on .ict-user-head { margin-bottom: 0.35rem; }
body.ict-fit-on .ict-axis { display: none; }
body.ict-fit-on .ict-matrix-wrap {
  overflow: hidden;
  max-height: none;
  height: var(--ict-fit-h, 60vh);
}
body.ict-fit-on .ict-matrix thead th {
  min-width: 1.55rem;
  padding: 0.22rem 0.1rem;
  font-size: 0.6rem;
}
body.ict-fit-on .ict-matrix .ict-corner {
  min-width: 5.5rem;
  padding-left: 0.35rem;
}
body.ict-fit-on .ict-matrix .ict-rowhead {
  max-width: 7.5rem;
  padding: 0.12rem 0.35rem;
  font-size: 0.62rem;
}
body.ict-fit-on .ict-cell-btn {
  min-width: 1.55rem;
  min-height: 1.35rem;
  padding: 0.12rem 0.08rem;
  font-size: 0.6rem;
}
body.ict-fit-on .ict-matrix .ict-col-total,
body.ict-fit-on .ict-matrix .ict-row-total {
  min-width: 3.6rem;
  font-size: 0.58rem;
  padding: 0.15rem 0.2rem;
}
.ict-matrix th,
.ict-matrix td {
  border-right: 1px solid rgba(196, 163, 90, 0.1);
  border-bottom: 1px solid rgba(196, 163, 90, 0.1);
  padding: 0;
  text-align: center;
  vertical-align: middle;
}
.ict-matrix thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #0e1a14;
  color: rgba(243, 239, 230, 0.75);
  font-weight: 600;
  padding: 0.4rem 0.2rem;
  min-width: 2.1rem;
}
.ict-matrix .ict-corner {
  left: 0;
  z-index: 4;
  min-width: 7.5rem;
  text-align: left;
  padding-left: 0.55rem;
}
.ict-matrix .ict-rowhead {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #0e1a14;
  text-align: left;
  padding: 0.28rem 0.55rem;
  white-space: nowrap;
  max-width: 11rem;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #f3efe6;
  font-family: var(--er-t-font);
  font-size: 0.72rem;
  font-weight: 500;
}
.ict-matrix .ict-col-total,
.ict-matrix .ict-row-total {
  background: rgba(196, 163, 90, 0.08);
  font-weight: 700;
  color: #e8d5a3;
  padding: 0.28rem 0.35rem;
  min-width: 4.5rem;
  white-space: nowrap;
  font-size: 0.64rem;
}
.ict-matrix thead .ict-col-total { z-index: 3; }

.ict-cell-btn {
  appearance: none;
  display: block;
  width: 100%;
  min-width: 2.1rem;
  min-height: 1.85rem;
  border: 0;
  background: transparent;
  color: #f3efe6;
  cursor: pointer;
  padding: 0.25rem 0.15rem;
  font: inherit;
  line-height: 1.1;
}
.ict-cell-btn:hover { outline: 1px solid rgba(196, 163, 90, 0.55); outline-offset: -1px; }
.ict-cell-btn .pct { font-weight: 700; }
.ict-cell-btn.is-empty { opacity: 0.28; cursor: default; }
.ict-cell-btn.is-red { background: rgba(185, 70, 70, 0.38); }
.ict-cell-btn.is-orange { background: rgba(196, 120, 50, 0.4); }
.ict-cell-btn.is-green { background: rgba(70, 150, 100, 0.5); color: #fff8e8; }

.ict-row-total.is-red,
.ict-col-total.is-red { background: rgba(185, 70, 70, 0.28) !important; }
.ict-row-total.is-orange,
.ict-col-total.is-orange { background: rgba(196, 120, 50, 0.28) !important; }
.ict-row-total.is-green,
.ict-col-total.is-green { background: rgba(70, 150, 100, 0.35) !important; }

.er-fld-check {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.er-fld-check span { font-size: 0.72rem; color: rgba(243, 239, 230, 0.7); }
.er-fld-check input { width: auto; }
