/* ============================================================
   ASTA — Style khusus fitur
   Lengan bionik, EMG, body map nyeri, mirror therapy, jadwal
   ============================================================ */

/* ---------------- Panel perangkat / EMG ---------------- */
.device-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: var(--s-5);
}
@media (max-width: 1100px) { .device-hero { grid-template-columns: 1fr; } }

.emg-canvas-wrap {
  border-radius: var(--r-md);
  background: #0d2148;
  box-shadow: var(--nm-in);
  padding: var(--s-2);
  position: relative;
}
.emg-canvas-wrap canvas { display: block; width: 100%; border-radius: var(--r-sm); }
.emg-legend {
  position: absolute;
  top: var(--s-3); right: var(--s-4);
  display: flex; gap: var(--s-4);
  font-size: var(--fs-xs);
  font-weight: 700;
  color: #cfe0ff;
}
.emg-legend span { display: inline-flex; align-items: center; gap: 6px; }
.emg-legend i { width: 12px; height: 3px; border-radius: 2px; display: block; }

.ch-meter { display: flex; flex-direction: column; gap: var(--s-2); }
.ch-row { display: grid; grid-template-columns: 88px 1fr 56px; align-items: center; gap: var(--s-3); }
.ch-name { font-size: var(--fs-xs); font-weight: 700; color: var(--text-2); }
.ch-val { font-size: var(--fs-xs); font-weight: 700; text-align: right; font-family: var(--font-mono); }
.ch-bar { height: 14px; border-radius: var(--r-pill); background: var(--bg); box-shadow: var(--nm-in); overflow: hidden; position: relative; }
.ch-bar > i { display: block; height: 100%; border-radius: var(--r-pill); transition: width 90ms linear; }
.ch-bar .thr {
  position: absolute; top: -3px; bottom: -3px;
  width: 3px; border-radius: 2px;
  background: var(--danger);
  box-shadow: 0 0 0 1px rgba(255,255,255,.7);
}

/* ---------------- Visual lengan bionik ---------------- */
.arm-stage {
  border-radius: var(--r-lg);
  background: radial-gradient(circle at 50% 30%, #f7faff 0%, var(--bg-deep) 70%);
  box-shadow: var(--nm-in);
  padding: var(--s-4);
  display: grid;
  place-items: center;
  min-height: 300px;
  position: relative;
}
.arm-stage svg { width: 100%; max-width: 320px; height: auto; overflow: visible; }

.finger-seg { transition: transform 110ms linear; transform-box: fill-box; }
.arm-palm { filter: drop-shadow(3px 5px 6px rgba(20,45,85,.22)); }

.arm-badge {
  position: absolute;
  top: var(--s-4); left: var(--s-4);
  display: flex; align-items: center; gap: 7px;
}

.grip-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-3); }
.grip-opt {
  border: 0;
  background: var(--surface);
  border-radius: var(--r-md);
  box-shadow: var(--nm-1);
  padding: var(--s-3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-2);
  min-height: 92px;
  transition: all var(--t);
  color: var(--text-2);
}
.grip-opt:hover { transform: translateY(-2px); box-shadow: var(--nm-2); color: var(--primary); }
.grip-opt[aria-pressed="true"] { box-shadow: var(--nm-in); background: var(--primary-50); color: var(--primary-700); }
.grip-opt .g-ico { color: inherit; }
.grip-opt .g-name { font-size: var(--fs-xs); font-weight: 700; text-align: center; line-height: 1.25; }

/* Indikator gaya cengkeram + haptik */
.force-gauge {
  height: 22px;
  border-radius: var(--r-pill);
  background: var(--bg);
  box-shadow: var(--nm-in);
  overflow: hidden;
  position: relative;
}
.force-gauge > i {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--success), var(--warning) 62%, var(--danger));
  transition: width 110ms linear;
}
.force-gauge .zone {
  position: absolute; top: 0; bottom: 0;
  border-left: 2px dashed rgba(255,255,255,.75);
}

.haptic-pads { display: flex; gap: var(--s-3); flex-wrap: wrap; }
.haptic-pad {
  width: 58px; height: 58px;
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--nm-1);
  display: grid;
  place-items: center;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text-3);
  transition: all 120ms ease;
  border: 0;
}
.haptic-pad.fire {
  background: linear-gradient(145deg, var(--violet), #5b3ce0);
  color: #fff;
  box-shadow: 0 0 0 5px var(--violet-soft), var(--nm-1);
  transform: scale(1.06);
}

/* Wizard kalibrasi */
.steps { display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap; }
.step-dot {
  display: flex; align-items: center; gap: var(--s-2);
  font-size: var(--fs-xs); font-weight: 700; color: var(--text-3);
}
.step-dot .sd {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: var(--nm-in-soft);
  display: grid; place-items: center;
  color: var(--text-3);
}
.step-dot.done .sd { background: var(--success); color: #fff; box-shadow: var(--nm-flat); }
.step-dot.now .sd { background: linear-gradient(145deg, var(--primary-400), var(--primary-600)); color: #fff; box-shadow: var(--nm-flat); }
.step-dot.now { color: var(--primary-700); }
.step-line { flex: 1; height: 3px; border-radius: 2px; background: var(--sh-dark-soft); min-width: 16px; }

/* ---------------- Body map nyeri ---------------- */
.bodymap-wrap {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: var(--s-5);
  align-items: start;
}
@media (max-width: 860px) { .bodymap-wrap { grid-template-columns: 1fr; } }

.bodymap {
  border-radius: var(--r-md);
  background: var(--bg-deep);
  box-shadow: var(--nm-in);
  padding: var(--s-4);
  position: relative;
}
.bodymap svg { width: 100%; height: auto; display: block; }
.bm-zone {
  fill: var(--surface-alt);
  stroke: var(--primary-200);
  stroke-width: 1.4;
  cursor: pointer;
  transition: fill var(--t), stroke var(--t);
}
.bm-zone:hover { fill: var(--primary-100); stroke: var(--primary-400); }
.bm-zone[data-selected="true"] { stroke: var(--primary-700); stroke-width: 2.4; }
.bm-phantom {
  stroke-dasharray: 6 4;
  fill: rgba(122,90,248,.09);
  stroke: var(--violet);
}
.bm-label { font-size: 9px; fill: var(--text-3); pointer-events: none; font-weight: 700; }

.pain-type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s-3); }

.legend-pain { display: flex; gap: var(--s-4); flex-wrap: wrap; font-size: var(--fs-xs); font-weight: 600; color: var(--text-2); }
.legend-pain span { display: inline-flex; align-items: center; gap: 6px; }
.legend-pain i { width: 14px; height: 14px; border-radius: 5px; display: block; box-shadow: var(--nm-flat); }

/* ---------------- Mirror therapy / GMI ---------------- */
.mirror-stage {
  border-radius: var(--r-lg);
  background: #0b1c3d;
  box-shadow: var(--nm-in);
  overflow: hidden;
  position: relative;
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
}
.mirror-stage video, .mirror-stage canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.mirror-stage video.src-hidden { opacity: 0; pointer-events: none; }
.mirror-divider {
  position: absolute; top: 0; bottom: 0; left: 50%;
  width: 2px;
  background: rgba(255,255,255,.34);
  box-shadow: 0 0 12px rgba(122,180,255,.6);
  z-index: 3;
}
.mirror-hint {
  position: absolute;
  bottom: var(--s-4);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(9,25,52,.76);
  color: #e7f0ff;
  padding: var(--s-2) var(--s-4);
  border-radius: var(--r-pill);
  font-size: var(--fs-sm);
  font-weight: 600;
  z-index: 4;
  backdrop-filter: blur(3px);
  text-align: center;
  max-width: 90%;
}
.mirror-off {
  color: #a8c4f0;
  text-align: center;
  padding: var(--s-6);
  z-index: 2;
}

/* Laterality recognition (GMI tahap 1) */
.lat-stage {
  border-radius: var(--r-lg);
  background: var(--surface-alt);
  box-shadow: var(--nm-in);
  display: grid;
  place-items: center;
  min-height: 290px;
  padding: var(--s-5);
}
.lat-stage svg { width: 172px; height: auto; }
.lat-answer { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); max-width: 460px; margin: 0 auto; }
.lat-btn { min-height: 76px; font-size: var(--fs-lg); }
.lat-btn.correct { animation: flash-ok 620ms ease; }
.lat-btn.wrong { animation: flash-bad 620ms ease; }
@keyframes flash-ok {
  0%, 100% { background: var(--surface); }
  35% { background: var(--success-soft); box-shadow: var(--nm-in); }
}
@keyframes flash-bad {
  0%, 100% { background: var(--surface); }
  35% { background: var(--danger-soft); box-shadow: var(--nm-in); }
}

/* Sensory discrimination */
.sd-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s-3); max-width: 420px; }
.sd-cell {
  aspect-ratio: 1;
  border: 0;
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--nm-1);
  font-weight: 700;
  color: var(--text-3);
  transition: all var(--t);
}
.sd-cell:hover { color: var(--primary); box-shadow: var(--nm-2); }
.sd-cell[aria-pressed="true"] { box-shadow: var(--nm-in); background: var(--primary-50); color: var(--primary-700); }
.sd-cell.reveal-ok { background: var(--success-soft); color: var(--success); }
.sd-cell.reveal-bad { background: var(--danger-soft); color: var(--danger); }

/* ---------------- Sesi latihan ---------------- */
.session-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: var(--s-5);
}
@media (max-width: 1000px) { .session-hero { grid-template-columns: 1fr; } }

.rep-counter { text-align: center; }
.rep-big {
  font-size: 62px;
  font-weight: 750;
  line-height: 1;
  letter-spacing: -.03em;
  color: var(--primary-700);
  font-variant-numeric: tabular-nums;
}
.rep-target { font-size: var(--fs-lg); color: var(--text-3); font-weight: 600; }

.timer-big {
  font-size: 44px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
  color: var(--text);
}

.cue-box {
  border-radius: var(--r-md);
  background: var(--bg);
  box-shadow: var(--nm-in);
  padding: var(--s-5);
  text-align: center;
  min-height: 104px;
  display: grid;
  place-items: center;
}
.cue-text { font-size: var(--fs-xl); font-weight: 650; color: var(--primary-700); }
.cue-sub { font-size: var(--fs-sm); color: var(--text-3); margin-top: 4px; }
.cue-box.hold { background: var(--primary-50); }
.cue-box.rest { background: var(--teal-soft); }
.cue-box.rest .cue-text { color: var(--teal); }

.ex-list { display: flex; flex-direction: column; gap: var(--s-3); }
.ex-item {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--nm-1);
  transition: all var(--t);
}
.ex-item.now { box-shadow: var(--nm-in); background: var(--primary-50); }
.ex-item.done { opacity: .68; }
.ex-num {
  width: 32px; height: 32px;
  border-radius: 11px;
  display: grid; place-items: center;
  background: var(--bg);
  box-shadow: var(--nm-in-soft);
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text-3);
  flex: 0 0 auto;
}
.ex-item.done .ex-num { background: var(--success); color: #fff; box-shadow: var(--nm-flat); }
.ex-item.now .ex-num { background: var(--primary); color: #fff; box-shadow: var(--nm-flat); }

/* ---------------- Jadwal & notifikasi ---------------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--s-2); }
.cal-dow {
  text-align: center;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .06em;
  padding-bottom: var(--s-2);
}
.cal-cell {
  border: 0;
  min-height: 76px;
  border-radius: var(--r-sm);
  background: var(--surface);
  box-shadow: var(--nm-flat);
  padding: var(--s-2);
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
  transition: all var(--t);
  position: relative;
}
.cal-cell:hover { box-shadow: var(--nm-2); }
.cal-cell.other { opacity: .38; }
.cal-cell.today { box-shadow: var(--nm-in), 0 0 0 2px var(--primary-300) inset; background: var(--primary-50); }
.cal-cell .cd { font-size: var(--fs-sm); font-weight: 700; color: var(--text-2); }
.cal-cell .cdots { display: flex; gap: 3px; flex-wrap: wrap; }
.cal-cell .cdot { width: 7px; height: 7px; border-radius: 50%; }
.cal-cell .cdot.done { background: var(--success); }
.cal-cell .cdot.miss { background: var(--danger); }
.cal-cell .cdot.plan { background: var(--primary-300); }
.cal-cell .cdot.pain { background: var(--violet); }

@media (max-width: 700px) { .cal-cell { min-height: 58px; } }

.sched-item {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-4);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--nm-1);
}
.sched-time {
  display: flex; flex-direction: column;
  align-items: center;
  min-width: 62px;
  padding: var(--s-2);
  border-radius: var(--r-sm);
  background: var(--bg);
  box-shadow: var(--nm-in-soft);
  flex: 0 0 auto;
}
.sched-time .h { font-size: var(--fs-lg); font-weight: 700; line-height: 1; }
.sched-time .m { font-size: var(--fs-xs); color: var(--text-3); font-weight: 600; }

/* Heatmap kepatuhan */
.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); gap: 4px; overflow-x: auto; padding-bottom: var(--s-2); }
.heat-cell {
  width: 15px; height: 15px;
  border-radius: 4px;
  background: var(--bg);
  box-shadow: var(--nm-in-soft);
}
.heat-cell[data-lvl="1"] { background: var(--primary-100); box-shadow: none; }
.heat-cell[data-lvl="2"] { background: var(--primary-200); box-shadow: none; }
.heat-cell[data-lvl="3"] { background: var(--primary-400); box-shadow: none; }
.heat-cell[data-lvl="4"] { background: var(--primary-600); box-shadow: none; }

/* ---------------- Grafik ---------------- */
.chart-box { position: relative; }
.chart-box canvas { display: block; width: 100%; }
.chart-legend { display: flex; gap: var(--s-4); flex-wrap: wrap; font-size: var(--fs-xs); font-weight: 600; color: var(--text-2); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 15px; height: 4px; border-radius: 2px; display: block; }
.chart-legend i.sq { width: 12px; height: 12px; border-radius: 4px; }

/* ---------------- Dashboard terapis ---------------- */
.pt-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.6fr) 108px 108px 92px 120px;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--nm-1);
  transition: all var(--t);
  cursor: pointer;
  text-align: left;
  border: 0;
  width: 100%;
}
.pt-row:hover { box-shadow: var(--nm-2); transform: translateY(-1px); }
.pt-row.risk { border-left: 4px solid var(--danger); }
@media (max-width: 900px) {
  .pt-row { grid-template-columns: 1fr 1fr; }
  .pt-row .hide-sm { display: none; }
}

.risk-flag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-xs); font-weight: 700;
}

/* ---------------- Detail kartu kecil ---------------- */
.kv { display: grid; grid-template-columns: 130px 1fr; gap: var(--s-2) var(--s-3); font-size: var(--fs-sm); }
.kv dt { color: var(--text-3); font-weight: 600; }
.kv dd { margin: 0; font-weight: 600; }

.mini-stat {
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  background: var(--bg);
  box-shadow: var(--nm-in-soft);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mini-stat .ms-v { font-size: var(--fs-lg); font-weight: 700; line-height: 1.15; }
.mini-stat .ms-l { font-size: var(--fs-xs); color: var(--text-3); font-weight: 600; }

/* Notifikasi list */
.notif-item {
  display: flex;
  gap: var(--s-3);
  padding: var(--s-4);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--nm-1);
  align-items: flex-start;
}
.notif-item.unread { background: var(--primary-50); }
.notif-ico {
  width: 40px; height: 40px;
  border-radius: 13px;
  display: grid; place-items: center;
  background: var(--bg);
  box-shadow: var(--nm-flat);
  flex: 0 0 auto;
  color: var(--primary);
}
.notif-ico.warning { color: var(--warning); }
.notif-ico.danger { color: var(--danger); }
.notif-ico.success { color: var(--success); }
.notif-ico.violet { color: var(--violet); }
