.evolution-module-body{
  display:grid;
  gap:20px;
}

.evolution-metrics{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:14px;
}

.evolution-metric-card{
  position:relative;
  min-width:0;
  padding:14px 50px 14px 14px;
  border:1px solid var(--line-soft);
  border-radius:var(--radius);
  background:var(--surface);
  color:var(--text);
  text-align:left;
  cursor:pointer;
  transition:border-color .2s ease,box-shadow .2s ease,background .2s ease;
}

.evolution-metric-card:not(:disabled):hover{
  border-color:color-mix(in srgb,var(--blue) 45%,var(--line-soft));
  background:color-mix(in srgb,var(--blue) 4%,var(--surface));
  box-shadow:var(--shadow-soft);
}

.evolution-metric-card:disabled{
  cursor:default;
}

.evolution-metric-card span{
  display:block;
  color:var(--muted);
  font-size:11px;
  font-weight:850;
  text-transform:uppercase;
  letter-spacing:.07em;
}

.evolution-metric-card strong{
  display:block;
  margin-top:6px;
  font-size:22px;
  line-height:1.1;
}

.evolution-metric-card small{
  display:block;
  margin-top:6px;
  color:var(--muted);
  font-size:12px;
  line-height:1.35;
}

.evolution-metric-card small em{
  font-style:normal;
  font-weight:800;
}

.evolution-metric-card .is-positive{
  color:var(--success);
}

.evolution-metric-card .is-negative{
  color:var(--danger);
}

.evolution-metric-card .is-neutral{
  color:var(--muted);
}

.evolution-metric-card i{
  position:absolute;
  top:14px;
  right:14px;
  width:28px;
  height:28px;
  color:var(--blue);
}

.evolution-metric-card i svg,
.evolution-upload-icon svg{
  width:100%;
  height:100%;
  fill:none;
  stroke:currentColor;
  stroke-width:1.8;
  stroke-linecap:round;
  stroke-linejoin:round;
}

.evolution-section-card{
  overflow:hidden;
  border:1px solid var(--line-soft);
  border-radius:var(--radius);
  background:var(--surface);
}

.evolution-section-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
  padding:18px 20px;
  border-bottom:1px solid var(--line-soft);
  background:color-mix(in srgb,var(--blue) 5%,var(--surface));
}

.evolution-section-head h4{
  margin:0 0 4px;
  color:var(--text);
  font-size:18px;
}

.evolution-section-head p{
  margin:0;
  color:var(--muted);
  font-size:13px;
}

.evolution-head-actions{
  display:flex;
  gap:8px;
}

.evolution-photo-strip{
  display:grid;
  grid-template-columns:repeat(6,minmax(0,1fr));
  gap:12px;
  padding:20px;
}

.evolution-photo-thumb{
  min-width:0;
  padding:0;
  overflow:hidden;
  border:1px solid var(--line-soft);
  border-radius:var(--radius);
  background:var(--surface-soft);
  color:var(--text);
  cursor:pointer;
  text-align:left;
}

.evolution-photo-thumb img{
  display:block;
  width:100%;
  aspect-ratio:3/4;
  object-fit:cover;
}

.evolution-photo-thumb span{
  display:block;
  min-height:48px;
  padding:10px;
  font-size:11px;
  font-weight:800;
  line-height:1.25;
  text-align:center;
}

.evolution-history-list{
  display:grid;
  gap:10px;
  padding:20px;
}

.evolution-history-row{
  display:grid;
  grid-template-columns:150px minmax(0,1fr) auto;
  align-items:center;
  gap:16px;
  min-width:0;
  padding:14px 16px;
  border:1px solid var(--line-soft);
  border-radius:var(--radius);
  background:var(--surface-soft);
  cursor:pointer;
  transition:border-color .2s ease,background .2s ease;
}

.evolution-history-row:hover{
  border-color:color-mix(in srgb,var(--blue) 42%,var(--line-soft));
  background:color-mix(in srgb,var(--blue) 4%,var(--surface-soft));
}

.evolution-history-date span,
.evolution-history-summary b,
.evolution-history-summary span{
  display:block;
}

.evolution-history-date span{
  color:var(--text);
  font-size:14px;
  font-weight:800;
}

.evolution-history-date small,
.evolution-history-summary span{
  margin-top:4px;
  color:var(--muted);
  font-size:12px;
}

.evolution-history-summary{
  min-width:0;
}

.evolution-history-summary b{
  overflow:hidden;
  color:var(--text);
  font-size:14px;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.evolution-history-summary span{
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.evolution-modal{
  position:fixed;
  inset:0;
  z-index:10020;
  display:grid;
  place-items:center;
  padding:22px;
  background:rgba(12,18,28,.58);
  backdrop-filter:blur(12px);
}

.evolution-modal[hidden]{
  display:none;
}

.evolution-modal-card{
  width:min(720px,100%);
  max-height:calc(100dvh - 44px);
  overflow:auto;
  border:1px solid var(--line-soft);
  border-radius:var(--radius);
  background:var(--surface);
  box-shadow:0 28px 80px rgba(0,0,0,.28);
}

.evolution-modal-card.is-wide{
  width:min(1080px,100%);
}

.evolution-modal-card.is-photo{
  width:min(760px,100%);
}

.evolution-modal-head{
  position:sticky;
  top:0;
  z-index:2;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
  padding:20px 22px;
  border-bottom:1px solid color-mix(in srgb,var(--blue) 24%,var(--line-soft));
  background:
    radial-gradient(circle at 12% 0%,color-mix(in srgb,var(--blue) 14%,transparent),transparent 34%),
    color-mix(in srgb,var(--blue) 7%,var(--surface));
}

.evolution-modal-head h3{
  margin:0 0 4px;
  font-size:22px;
}

.evolution-modal-head p{
  margin:0;
  color:var(--muted);
  font-size:13px;
}

.evolution-modal-body{
  display:grid;
  gap:18px;
  padding:22px;
}

.evolution-form-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:14px;
}

.evolution-form-grid.is-three{
  grid-template-columns:repeat(3,minmax(0,1fr));
}

.evolution-form-section{
  overflow:hidden;
  border:1px solid var(--line-soft);
  border-radius:var(--radius);
  background:var(--surface);
}

.evolution-form-section-head{
  padding:16px 18px 14px;
  border-bottom:1px solid var(--line-soft);
  background:var(--surface-soft);
}

.evolution-form-section-head h4{
  margin:0 0 3px;
  font-size:15px;
}

.evolution-form-section-head p{
  margin:0;
  color:var(--muted);
  font-size:12px;
}

.evolution-form-section > .evolution-form-grid,
.evolution-form-section > .field,
.evolution-form-section > .evolution-upload-slot{
  margin:18px;
}

.evolution-field-error{
  display:block;
  min-height:16px;
  margin-top:4px;
  color:var(--danger);
  font-size:11px;
  font-weight:700;
}

.evolution-date-field input.is-invalid{
  border-color:var(--danger)!important;
  box-shadow:0 0 0 4px color-mix(in srgb,var(--danger) 14%,transparent)!important;
}

.evolution-photo-upload-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:12px;
  padding:18px;
}

.evolution-upload-slot{
  position:relative;
  min-width:0;
  min-height:120px;
  border:1px dashed var(--line);
  border-radius:var(--radius);
  background:var(--surface-soft);
  color:var(--text);
  text-align:center;
}

.evolution-upload-slot:hover,
.evolution-upload-slot.is-selected{
  border-color:var(--blue);
  background:color-mix(in srgb,var(--blue) 6%,var(--surface-soft));
}

.evolution-upload-trigger{
  display:grid;
  min-height:118px;
  place-items:center;
  align-content:center;
  gap:5px;
  padding:16px 42px;
  cursor:pointer;
}

.evolution-upload-slot input{
  position:absolute;
  width:1px;
  height:1px;
  opacity:0;
}

.evolution-upload-icon{
  width:28px;
  height:28px;
  color:var(--blue);
}

.evolution-upload-slot b{
  font-size:13px;
}

.evolution-upload-slot small{
  max-width:100%;
  overflow:hidden;
  color:var(--muted);
  font-size:11px;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.evolution-open-file{
  position:absolute;
  right:42px;
  bottom:9px;
  color:var(--blue);
  font-size:11px;
  font-weight:700;
  text-decoration:none;
}

.evolution-open-file:hover{
  text-decoration:underline;
}

.evolution-remove-file{
  position:absolute;
  top:8px;
  right:8px;
  display:grid;
  width:30px;
  height:30px;
  place-items:center;
  border:1px solid var(--line-soft);
  border-radius:50%;
  background:var(--surface);
  color:var(--danger);
}

.evolution-remove-file svg{
  width:15px;
  height:15px;
  fill:none;
  stroke:currentColor;
  stroke-width:1.8;
}

.evolution-modal-actions{
  position:sticky;
  bottom:0;
  z-index:2;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:16px 22px;
  border-top:1px solid var(--line-soft);
  background:color-mix(in srgb,var(--surface) 96%,transparent);
  backdrop-filter:blur(12px);
}

.evolution-modal-actions > div{
  display:flex;
  gap:8px;
}

.evolution-danger-button{
  border-color:color-mix(in srgb,var(--danger) 35%,var(--line-soft));
  color:var(--danger);
}

.evolution-danger-button:hover{
  border-color:var(--danger);
  background:color-mix(in srgb,var(--danger) 7%,var(--surface));
}

.evolution-chart{
  box-sizing:border-box;
  height:310px;
  max-height:310px;
  min-width:0;
  overflow:hidden;
  padding:14px;
  border:1px solid var(--line-soft);
  border-radius:var(--radius);
  background:var(--surface-soft);
}

.evolution-chart.is-empty{
  display:grid;
  place-items:center;
  overflow:hidden;
}

.evolution-chart-navigation{
  display:grid;
  grid-template-columns:44px minmax(170px,auto) 44px;
  align-items:center;
  width:max-content;
  max-width:100%;
  margin:14px auto 0;
  gap:8px;
}

.evolution-chart-navigation strong{
  color:var(--text);
  font-size:13px;
  text-align:center;
}

.evolution-chart-navigation button:disabled{
  cursor:default;
  opacity:.38;
  pointer-events:none;
}

.evolution-chart svg{
  display:block;
  width:100%;
  height:280px;
  min-width:0;
  max-width:100%;
}

.evolution-chart .chart-axis{
  stroke:var(--line);
}

.evolution-chart .chart-line{
  fill:none;
  stroke:var(--blue);
  stroke-width:3;
  stroke-linecap:round;
  stroke-linejoin:round;
}

.evolution-chart .chart-dot{
  fill:var(--surface);
  stroke:var(--blue);
  stroke-width:3;
}

.evolution-chart text{
  fill:var(--muted);
  font-size:11px;
  font-weight:700;
}

.evolution-chart-empty{
  box-sizing:border-box;
  display:grid;
  width:100%;
  height:100%;
  min-height:0;
  padding:20px;
  place-items:center;
  border:1px dashed var(--line);
  border-radius:var(--radius);
  color:var(--muted);
  text-align:center;
}

.evolution-compare-selects{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:14px;
}

.evolution-comparison-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:14px;
}

.evolution-comparison-item{
  display:block;
  width:100%;
  padding:0;
  overflow:hidden;
  border:1px solid var(--line-soft);
  border-radius:var(--radius);
  background:var(--surface);
  color:var(--text);
  cursor:pointer;
  text-align:left;
  transition:border-color .2s ease,box-shadow .2s ease;
}

.evolution-comparison-item:hover{
  border-color:color-mix(in srgb,var(--blue) 48%,var(--line-soft));
  box-shadow:var(--shadow-soft);
}

.evolution-comparison-item h4{
  margin:0;
  padding:12px 14px;
  border-bottom:1px solid var(--line-soft);
  font-size:13px;
  text-align:center;
}

.evolution-comparison-item > div{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
}

.evolution-comparison-item figure{
  display:grid;
  grid-template-rows:minmax(0,1fr) auto;
  min-width:0;
  min-height:240px;
  margin:0;
  overflow:hidden;
  background:color-mix(in srgb,var(--blue) 5%,var(--surface));
}

.evolution-comparison-item figure + figure{
  border-left:1px solid var(--line-soft);
}

.evolution-comparison-item img{
  display:block;
  width:100%;
  height:260px;
  object-fit:cover;
  background:color-mix(in srgb,var(--blue) 5%,var(--surface));
}

.evolution-comparison-item figcaption{
  width:100%;
  padding:10px 12px;
  border-top:1px solid var(--line-soft);
  background:var(--surface);
  color:var(--muted);
  font-size:11px;
  font-weight:800;
  text-align:center;
}

.evolution-detail-section{
  overflow:hidden;
  border:1px solid var(--line-soft);
  border-radius:var(--radius);
  background:var(--surface);
}

.evolution-detail-section > h4{
  margin:0;
  padding:14px 16px;
  border-bottom:1px solid var(--line-soft);
  background:var(--surface-soft);
  font-size:15px;
}

.evolution-detail-grid{
  display:grid;
  gap:10px;
  padding:16px;
}

.evolution-detail-grid.is-three{
  grid-template-columns:repeat(3,minmax(0,1fr));
}

.evolution-detail-item{
  padding:12px 14px;
  border:1px solid var(--line-soft);
  border-radius:var(--radius);
  background:var(--surface-soft);
}

.evolution-detail-item span,
.evolution-detail-item b{
  display:block;
}

.evolution-detail-item span{
  color:var(--muted);
  font-size:11px;
  font-weight:800;
  text-transform:uppercase;
}

.evolution-detail-item b{
  margin-top:5px;
  color:var(--text);
  font-size:14px;
}

.evolution-detail-photos{
  padding:16px;
}

.evolution-detail-notes{
  margin:0;
  padding:16px;
  color:var(--text);
  font-size:14px;
  line-height:1.55;
}

.evolution-detail-file{
  margin:16px;
}

.evolution-detail-file svg{
  width:17px;
  height:17px;
  fill:none;
  stroke:currentColor;
  stroke-width:1.8;
}

.evolution-pair-viewer{
  display:grid;
  grid-template-columns:auto minmax(0,1fr) auto;
  align-items:center;
  gap:14px;
  padding:18px;
  background:color-mix(in srgb,var(--blue) 5%,var(--surface));
}

.evolution-pair-photos{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:12px;
}

.evolution-pair-photos figure{
  display:grid;
  grid-template-rows:minmax(0,1fr) auto;
  min-width:0;
  min-height:420px;
  margin:0;
  overflow:hidden;
  border:1px solid var(--line-soft);
  border-radius:var(--radius);
  background:var(--surface);
}

.evolution-pair-photos img{
  display:block;
  width:100%;
  height:min(68dvh,720px);
  object-fit:cover;
}

.evolution-pair-photos figcaption{
  width:100%;
  padding:12px 14px;
  border-top:1px solid var(--line-soft);
  background:var(--surface);
  color:var(--muted);
  font-size:12px;
  font-weight:800;
  text-align:center;
}

.evolution-pair-viewer.is-single .evolution-pair-photos{
  grid-template-columns:minmax(0,1fr);
  width:min(680px,100%);
  margin-inline:auto;
}

.evolution-pair-viewer.is-single .evolution-pair-photos figure{
  min-height:0;
}

.evolution-pair-viewer.is-single .evolution-pair-photos img{
  height:min(68dvh,720px);
  object-fit:contain;
  background:color-mix(in srgb,var(--blue) 5%,var(--surface));
}

.evolution-pair-nav{
  display:grid;
  width:44px;
  height:44px;
  place-items:center;
  border:1px solid var(--line);
  border-radius:50%;
  background:var(--surface);
  color:var(--text);
  cursor:pointer;
}

.evolution-pair-nav:hover{
  border-color:var(--blue);
  background:color-mix(in srgb,var(--blue) 30%,transparent);
}

.evolution-pair-nav svg{
  width:18px;
  height:18px;
  fill:none;
  stroke:currentColor;
  stroke-width:2;
}

.evolution-pair-actions span{
  color:var(--muted);
  font-size:12px;
  font-weight:800;
}

@media (max-width:980px){
  .evolution-photo-strip{
    grid-template-columns:repeat(3,minmax(0,1fr));
  }

  .evolution-photo-upload-grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
}

@media (max-width:720px){
  .evolution-metrics,
  .evolution-form-grid,
  .evolution-form-grid.is-three,
  .evolution-compare-selects,
  .evolution-detail-grid.is-three,
  .evolution-comparison-grid{
    grid-template-columns:1fr;
  }

  .evolution-section-head{
    align-items:flex-start;
    flex-direction:column;
    gap:14px;
    padding:16px;
  }

  .evolution-head-actions{
    width:100%;
    justify-content:flex-end;
  }

  .evolution-history-row{
    grid-template-columns:1fr auto;
  }

  .evolution-history-summary{
    grid-column:1/-1;
    grid-row:2;
  }

  .evolution-history-row .row-actions{
    grid-column:2;
    grid-row:1;
  }

  .evolution-modal{
    place-items:center;
    padding:
      max(12px, env(safe-area-inset-top))
      max(12px, env(safe-area-inset-right))
      max(12px, env(safe-area-inset-bottom))
      max(12px, env(safe-area-inset-left));
  }

  .evolution-modal-card,
  .evolution-modal-card.is-wide,
  .evolution-modal-card.is-photo{
    width:100%;
    max-height:calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px);
    border-radius:24px;
  }

  .evolution-modal-head{
    padding:16px;
  }

  .evolution-modal-head h3{
    font-size:19px;
  }

  .evolution-modal-body{
    gap:14px;
    padding:16px;
  }

  .evolution-modal-actions{
    flex-wrap:wrap;
    padding:14px 16px;
  }

  .evolution-modal-actions > div{
    margin-left:auto;
    flex-wrap:wrap;
    justify-content:flex-end;
  }

  .evolution-photo-upload-grid{
    grid-template-columns:1fr;
  }

  .evolution-chart-navigation{
    grid-template-columns:44px minmax(0,1fr) 44px;
  }

  .evolution-pair-viewer{
    position:relative;
    display:block;
    padding:12px;
  }

  .evolution-pair-photos{
    grid-template-columns:1fr;
    gap:8px;
  }

  .evolution-pair-photos figure{
    min-height:260px;
  }

  .evolution-pair-photos img{
    height:60dvh;
  }

  .evolution-pair-viewer.is-single .evolution-pair-photos img{
    height:min(66dvh,640px);
  }

  .evolution-pair-nav{
    position:absolute;
    top:50%;
    z-index:2;
    transform:translateY(-50%);
    box-shadow:var(--shadow-soft);
  }

  .evolution-pair-nav:first-child{
    left:22px;
  }

  .evolution-pair-nav:last-child{
    right:22px;
  }
}

@media (max-width:480px){
  .evolution-photo-strip{
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:10px;
    padding:14px;
  }

  .evolution-history-list{
    gap:8px;
    padding:14px;
  }

  .evolution-history-row{
    gap:10px;
    padding:13px;
  }

  .evolution-modal{
    padding:
      max(10px, env(safe-area-inset-top))
      max(10px, env(safe-area-inset-right))
      max(10px, env(safe-area-inset-bottom))
      max(10px, env(safe-area-inset-left));
  }

  .evolution-modal-card,
  .evolution-modal-card.is-wide,
  .evolution-modal-card.is-photo{
    max-height:calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 20px);
    border-radius:22px;
  }

  .evolution-modal-actions{
    align-items:stretch;
  }

  .evolution-modal-actions > div{
    width:100%;
  }

  .evolution-modal-actions > div .btn{
    flex:1 1 auto;
  }

  .evolution-modal-body,
  #evolutionChartContent{
    width:100%;
    min-width:0;
    max-width:100%;
    overflow:hidden;
  }

  .evolution-chart{
    width:100%;
    min-width:0;
    height:280px;
    max-height:280px;
    padding:10px 6px;
    overflow:hidden;
  }

  .evolution-chart svg{
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    height:258px;
    overflow:visible;
  }

  .evolution-chart text{
    font-size:10px;
  }

  .evolution-chart-navigation{
    width:100%;
    grid-template-columns:40px minmax(0,1fr) 40px;
    gap:6px;
  }
}
