.service-record-canvas {
  box-sizing: border-box;
  position: relative;
  isolation: isolate;
  container-type: inline-size;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid #cbd5e1;
  border-radius: 1rem;
  color: #172033;
  background: #f5f6f8;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .12);
}

.service-record-canvas.is-distribution {
  border: .35cqw solid #111;
  border-radius: 0;
  color: #111;
  background: #fff;
  box-shadow: none;
}

.service-record-canvas.is-distribution::after {
  position: absolute;
  z-index: 6;
  inset: 0 0 auto;
  height: 1.15cqw;
  background: var(--service-record-accent, var(--app-accent, #da1a21));
  content: "";
}

.service-record-canvas::before {
  position: absolute;
  z-index: -2;
  inset: 0 0 0 60%;
  border-left: 1px solid rgba(218, 26, 33, .12);
  background: #fff3f3;
  content: "";
}

.canvas-candidate {
  position: absolute;
  z-index: 0;
  right: -5%;
  bottom: 0;
  width: 135%;
  height: 100%;
  object-fit: cover;
  object-position: right bottom;
  pointer-events: none;
  user-select: none;
}

.is-distribution .canvas-candidate {
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center bottom;
}

.canvas-home-qr {
  position: absolute;
  z-index: 4;
  right: 3cqw;
  bottom: 3cqw;
  box-sizing: border-box;
  width: 16cqw;
  height: 16cqw;
  border: 1px solid #cbd5e1;
  border-radius: .8cqw;
  padding: .65cqw;
  object-fit: contain;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .14);
}

.is-distribution .canvas-home-qr {
  right: 2.2cqw;
  bottom: 2.2cqw;
  width: 14cqw;
  height: 14cqw;
  border: .35cqw solid #111;
  border-radius: 0;
  padding: .7cqw;
  box-shadow: none;
}

.canvas-header {
  position: relative;
  z-index: 3;
  display: grid;
  height: 18cqw;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 2.2cqw;
  border-bottom: .65cqw solid var(--service-record-accent, var(--app-accent, #da1a21));
  padding: 2.5cqw 3.2cqw;
  background: rgba(255, 255, 255, .96);
}

.is-distribution .canvas-header {
  height: 18cqw;
  gap: 2cqw;
  border-bottom: .35cqw solid #111;
  padding: 3.2cqw 3.5cqw 2.4cqw;
  background: #fff;
}

.canvas-logos {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 1.25cqw;
}

.canvas-logos img {
  display: block;
  width: auto;
  height: 7.4cqw;
  max-width: 15cqw;
  object-fit: contain;
}

.canvas-logos .canvas-harapan-logo { width: 14.8cqw; }
.canvas-logos .canvas-party-logo { max-width: 9cqw; }

.canvas-title { min-width: 0; }

.canvas-title h3 {
  overflow: hidden;
  margin: 0;
  color: #111827;
  font-size: 3.2cqw;
  line-height: 1.18;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.canvas-title time {
  display: block;
  overflow: hidden;
  margin-top: .65cqw;
  color: #475467;
  font-size: 1.65cqw;
  font-weight: 700;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.is-distribution .canvas-title h3 {
  color: #111;
  font-size: 3.15cqw;
  letter-spacing: 0;
}

.is-distribution .canvas-title time {
  color: #525252;
  font-size: 1.55cqw;
  letter-spacing: 0;
}

.canvas-body {
  position: relative;
  z-index: 2;
  display: grid;
  height: 82cqw;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
}

.is-distribution .canvas-body {
  height: 73.7cqw;
  grid-template-columns: minmax(0, 61fr) minmax(0, 39fr);
  background: #faf5f5;
}

.canvas-data {
  display: grid;
  min-width: 0;
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 2fr);
  border-right: 1px solid rgba(203, 213, 225, .8);
  background: rgba(255, 255, 255, .94);
}

.is-distribution .canvas-data {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: 20cqw minmax(0, 1fr);
  border-right: .35cqw solid #111;
  background: #fff;
}

.canvas-metric {
  display: flex;
  min-height: 0;
  align-items: center;
  justify-content: space-between;
  gap: 2cqw;
  border-bottom: 1px solid #dce2ea;
  padding: 2.8cqw 4.1cqw;
}

.is-distribution .canvas-metric {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  flex-direction: column;
  gap: 1cqw;
  border-bottom: .35cqw solid #111;
  padding: 3cqw 3.4cqw;
}

.is-distribution .canvas-metric + .canvas-metric {
  border-left: 1px solid #d4d4d4;
}

.canvas-metric span {
  min-width: 0;
  color: #475467;
  font-size: 2.25cqw;
  font-weight: 750;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.is-distribution .canvas-metric span {
  color: #525252;
  font-size: 1.85cqw;
  font-weight: 800;
}

.canvas-metric strong {
  flex: 0 0 auto;
  color: #111827;
  font-size: 7cqw;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  letter-spacing: -.04em;
  line-height: 1;
}

.is-distribution .canvas-metric strong {
  color: #111;
  font-size: 6.4cqw;
  letter-spacing: 0;
}

.is-distribution .canvas-metric:nth-child(2) strong {
  color: var(--service-record-accent, var(--app-accent, #da1a21));
}

.canvas-trend {
  display: grid;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 1.8cqw;
  padding: 3cqw 3.6cqw 3.2cqw;
}

.canvas-trend-heading {
  display: flex;
  min-width: 0;
  align-items: baseline;
  justify-content: space-between;
  gap: 2cqw;
}

.canvas-trend-heading h4 {
  margin: 0;
  color: #273246;
  font-size: 2.2cqw;
  line-height: 1.2;
}

.canvas-trend-heading span {
  overflow: hidden;
  color: #667085;
  font-size: 1.55cqw;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.canvas-bars {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  align-items: stretch;
  gap: clamp(1px, .65cqw, 6px);
  border-bottom: 1px solid #cbd5e1;
}

.canvas-bar {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: minmax(0, 1fr) 3.8cqw;
  gap: .65cqw;
}

.canvas-bar-plot {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 0;
  align-items: end;
  justify-content: center;
}

.canvas-bar-fill {
  position: relative;
  width: min(72%, 3.6cqw);
  min-width: 1px;
  min-height: 1px;
  border-radius: .45cqw .45cqw 0 0;
  background: var(--service-record-accent, var(--app-accent, #da1a21));
}

.canvas-bar-value {
  position: absolute;
  bottom: calc(100% + .35cqw);
  left: 50%;
  color: #344054;
  font-size: 1.35cqw;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  transform: translateX(-50%);
  white-space: nowrap;
}

.canvas-bar-label {
  overflow: hidden;
  color: #667085;
  font-size: 1.25cqw;
  font-weight: 650;
  line-height: 1.15;
  text-align: center;
  text-overflow: clip;
  white-space: nowrap;
}

.canvas-bar.hide-label .canvas-bar-label,
.canvas-bar.hide-value .canvas-bar-value { visibility: hidden; }

.canvas-empty {
  align-self: center;
  margin: 0;
  color: #667085;
  font-size: 1.8cqw;
  text-align: center;
}

.canvas-portrait-space {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.canvas-distribution {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-column: 1 / -1;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 2cqw;
  padding: 3cqw 3.5cqw 2.6cqw;
}

.canvas-distribution-heading {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 2cqw;
}

.canvas-distribution-heading h4 {
  position: relative;
  margin: 0;
  padding-left: 2cqw;
  color: #111;
  font-size: 2.15cqw;
  line-height: 1.2;
}

.canvas-distribution-heading h4::before {
  position: absolute;
  top: 50%;
  left: 0;
  width: 1.15cqw;
  height: 1.15cqw;
  background: var(--service-record-accent, var(--app-accent, #da1a21));
  content: "";
  transform: translateY(-50%);
}

.canvas-distribution-heading > span {
  color: #737373;
  font-size: 1.35cqw;
  font-weight: 700;
  white-space: nowrap;
}

.canvas-distribution-list {
  display: grid;
  min-width: 0;
  min-height: 0;
  align-content: space-between;
  gap: 1.35cqw;
}

.canvas-distribution-item {
  display: grid;
  min-width: 0;
  gap: .7cqw;
}

.canvas-distribution-row {
  display: flex;
  min-width: 0;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5cqw;
  color: #262626;
  font-size: 1.55cqw;
  line-height: 1.2;
}

.canvas-distribution-row > span {
  overflow: hidden;
  min-width: 0;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.canvas-distribution-row strong {
  flex: 0 0 auto;
  color: #111;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.canvas-distribution-row small {
  color: #737373;
  font-size: 1.2cqw;
  font-weight: 600;
}

.canvas-distribution-track {
  overflow: hidden;
  height: 1.55cqw;
  border: 1px solid #d4d4d4;
  background: #f5f5f5;
}

.canvas-distribution-track span {
  display: block;
  min-width: 1px;
  height: 100%;
  background: #a3a3a3;
}

.canvas-distribution-item:first-child .canvas-distribution-track span {
  background: var(--service-record-accent, var(--app-accent, #da1a21));
}

.canvas-distribution-item:nth-child(2) .canvas-distribution-track span {
  background: #111;
}

.canvas-distribution-item:nth-child(3) .canvas-distribution-track span {
  background: #525252;
}

.canvas-distribution-item:nth-child(4) .canvas-distribution-track span {
  background: #737373;
}

.canvas-footer {
  display: none;
}

.is-distribution .canvas-footer {
  position: relative;
  z-index: 5;
  display: flex;
  box-sizing: border-box;
  height: 8cqw;
  align-items: center;
  justify-content: space-between;
  gap: 2cqw;
  padding: 0 3.5cqw;
  color: #fff;
  background: #111;
  font-size: 1.4cqw;
  line-height: 1.2;
}

.is-distribution .canvas-footer strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.is-distribution .canvas-footer span {
  flex: 0 0 auto;
  color: #d4d4d4;
  font-weight: 700;
}
