/*:root {
  font-family: "Noto Sans KR", "Noto Sans", "Segoe UI", "Helvetica Neue", Arial,
    sans-serif;
  color: #0f172a;
  background-color: #f8fafc;
}

* {
  box-sizing: border-box;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

a {
  text-decoration: none;
}*/


.chart_test_info {display:block;text-align:center;height:40px;line-height:40px;color:#333;background:#eeeeee; border-radius:10px; margin:0 0 5px 0; font-weight:500;}

.supplyC_wrap {
  /* display: flex; */
  flex-direction: column;
  min-height: 100vh;
  /* height: 100vh; */
  /* overflow: hidden; */
  width: 1280px;
  /*max-width: 100%;*/
  margin: 0 auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

ul {
  margin: 0;
}

main {
  flex: 1;
  display: grid;
  grid-template-columns: 1.8fr 1fr;
  grid-template-rows: minmax(420px, 1.15fr) minmax(320px, 0.85fr);
  grid-template-areas:
    "map port-list"
    "chart table";
  gap: 1rem;
  padding: 1.2rem;
  height: 100%;
  min-height: 0;
}

.port-list {
  grid-area: port-list;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.map-panel {
  grid-area: map;
  flex: 2 1 0;
  min-width: 0;
  background: #FFF;
  border: 1px solid #d2d7db;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.1);
  overflow: hidden;
  min-height: 420px;
  max-height: 100dvh;*
}

#map {
  width: 100%;
  height: 100%;
}

.port-list,
.chart-panel,
.table-panel {
  background: #fff;
  border-radius: 14px;
  padding: 1rem;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  min-width: 0;
  border: 1px solid #d2d7db;
}

.chart-panel {
  grid-area: chart;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.chart-panel__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}

.chart-panel__meta {
  display: inline-flex;
  align-items: baseline;
  gap: 0.25rem;
  flex: 0 0 auto;
}

.chart-panel__unit {
  font-size: 0.72rem;
  font-weight: 500;
  color: #64748b;
  white-space: nowrap;
}

.chart-panel__title {
  font-size: 1rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.02rem;
}

.chart-title__line1 {
  font-size: 1rem;
  font-weight: 900;
  color: #0f172a;
}

.chart-title__line2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0;
}

.chart-title__portWrap {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.chart-title__flag {
  width: 18px;
  height: 12px;
  object-fit: cover;
  flex: 0 0 auto;
}

.chart-title__port {
  font-size: 0.95rem;
  font-weight: 800;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-title__rangeInline {
  font-size: 0.8rem;
  font-weight: 700;
  color: #475569;
  white-space: nowrap;
}

.chart-panel__range {
  font-size: 0.85rem;
  font-weight: 700;
  color: #475569;
  white-space: nowrap;
}

.chart-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0.25rem 0 0.75rem;
  padding: 0 10px;
}

.chart-legend__group {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex-wrap: wrap;
}

.chart-legend__group--right {
  margin-left: auto;
  justify-content: flex-end;
  flex-wrap: nowrap;
}

.chart-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.chart-legend__dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  flex: 0 0 auto;
}

.chart-legend__text {
  font-size: 0.75rem;
  font-weight: 500;
  color: #475569;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.table-panel {
  grid-area: table;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.table-panel__meta {
  display: flex;
  justify-content: flex-end;
  padding-right: 0.25rem;
  margin-bottom: 0.5rem;
}

.table-panel__unit {
  font-size: 0.72rem;
  font-weight: 500;
  color: #64748b;
  white-space: nowrap;
}

.port-list h2 {
  margin: 0;
  font-size: 1rem;
}

.port-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.port-list-header__left {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}

.port-list-header__left h2 {
  height: 22px;
  line-height: 22px;
}

.auto-rotate-control {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.25rem;
}

.port-list-control-button {
  border: 1px solid #d2d7db;
  background: #f2f6f9;
  color: #0f172a;
  padding: 0;
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  line-height: 0;
  flex: 0 0 auto;
  border-radius: 7px;
}

.port-list-control-button__icon {
  width: 14px;
  height: 14px;
  fill: currentColor;
  flex: 0 0 auto;
  display: block;
}

.port-list-control-button .icon-play {
  display: none;
}

.port-list-control-button.is-paused .icon-pause {
  display: none;
}

.port-list-control-button.is-paused .icon-play {
  display: inline-block;
}

.port-list-control-button:hover {
  color: #1260cf;
  background: #e8eef4;
  border-color: #b7c7d3;
}

.port-list-control-button:active {
  color: #0b4aa3;
  background: #dbeafe;
  border-color: #93c5fd;
}

.port-list-control-button:focus-visible {
  outline: 2px solid rgba(18, 96, 207, 0.55);
  outline-offset: 2px;
}

/* 키보드 접근성: 토글 스위치도 포커스 표시 */
.toggle-switch input[type="checkbox"]:focus-visible + .toggle-switch__track {
  outline: 2px solid rgba(18, 96, 207, 0.55);
  outline-offset: 2px;
}

.port-button:focus-visible {
  outline: 2px solid rgba(18, 96, 207, 0.55);
  outline-offset: 2px;
}

/* Avoid Suez 토글 스위치 */
.toggle-switch {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.45rem;

  cursor: pointer;
  color: #111111;
}

.toggle-switch input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-switch__track {
  position: relative;
  width: 36px;
  height: 18px;
  background: #cbd5f5;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  margin-top: 0.1rem;
  padding: 2px;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.7);
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.toggle-switch__thumb {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.4);
  transform: translateX(0);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.toggle-switch input[type="checkbox"]:checked + .toggle-switch__track {
  background: #1d4ed8;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.8);
}

.toggle-switch
  input[type="checkbox"]:checked
  + .toggle-switch__track
  .toggle-switch__thumb {
  transform: translateX(18px);
}

.toggle-switch__label {
  white-space: nowrap;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
}

#portList {
  list-style: none;
  padding: 0;
  margin-top: 0.8rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  flex: 0 0 auto;
}

.port-summary-card {
  margin-top: 0.75rem;
  border: 1px solid #d2d7db;
  border-radius: 8px;
  background: #f2f6f9;
  color: #475569;
  padding: 0.6rem;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.port-summary-card__header {
  font-size: 0.8rem;
  font-weight: 900;
  color: #0f172a;
  margin-bottom: 0.3rem;
}

.port-summary-card__content {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding-right: 0.15rem; 
}

.port-summary-card__line {
  display: grid;
  grid-template-columns: 62px 1fr;
  gap: 0.3rem;
  align-items: start;
}

.port-summary-card__line + .port-summary-card__line {
  margin-top: 0.2rem;
}

.port-summary-card__label {
  font-size: 0.75rem;
  font-weight: 800;
  color: #64748b;
  white-space: nowrap;
}

.port-summary-card__value {
  font-size: 0.75rem;
  line-height: 1.4;
  color: #334155;
  word-break: keep-all;
}

.port-button {
  width: 100%;
  padding: 0.45rem;
  border: 1px solid #d2d7db;
  border-radius: 8px;
  background: #f2f6f9;
  color: #696a6e;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease,
    transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.4rem;
  text-align: left;
}

.port-button:hover {
  background: #e8eef4;
  border-color: #b7c7d3;
  color: #424346;
  transform: translateY(-1px);
}

.port-button.is-active {
  background: #1260cf;
  color: #fff;
  box-shadow: 0 5px 13px rgba(0, 0, 0, 0.2);
}

.port-button .port-name {
  flex: 1;
  line-height: 1.3;
}

.port-title-flag {
  width: 28px;
  height: 18px;
  object-fit: cover;
  margin-right: 0.35rem;
  box-shadow: 0 0 5px rgba(15, 23, 42, 0.2);
  vertical-align: middle;
}

.port-table {
  overflow-y: auto;
  overflow-x: auto;
  background: #fff;
  flex: 1 1 0;
  min-height: 0;
}

.port-table table {
  width: 100%;
  min-width: 350px;
  font-size: 0.8rem;
  border-collapse: collapse;
}

.port-table th,
.port-table td {
  padding-top: 0.4rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid #dddddd;
  border-right: 1px solid #dddddd;
  text-align: center;
  font-size: 0.72rem;

}

.port-table th:last-child,
.port-table td:last-child {
  border-right: none !important;
}

.port-table thead th {
  position: sticky;
  top: 0;
  font-size: 0.68rem;
  background: #f4f7fb;
  /* border-collapse: collapse 상태에선 border-top이 테이블로 합쳐져 sticky처럼 안 따라올 수 있어
     셀 자체에 붙는 inset shadow로 대체 */
  box-shadow: inset 0 2px 0 #111111;
  color: #111111;
  z-index: 2;
}


.chart-container {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

canvas#portChart {
  width: 100% !important;
  height: 100% !important;
  max-height: 340px !important;
  min-height: 180px !important;
  display: block;
}

/* ===== leaflet ===== */
.leaflet-popup-content .popup-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 4px;
}

.leaflet-popup-content .popup-flag-img {
  width: 25px;
  height: 15px;
  object-fit: cover;
  box-shadow: 0 0 5px rgba(15, 23, 42, 0.2);
}

.leaflet-bar.reset-view-control {
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.18);
}

.reset-view-control__button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: #fff;
  border: none;
  cursor: pointer;
  font-size: 1.05rem;
  color: #1e293b;
}

.reset-view-control__button:hover {
  background: #e0f2fe;
  color: #1d4ed8;
}

.reset-view-control__button:active {
  background: #bfdbfe;
}

.reset-view-control__button span {
  pointer-events: none;
}

.leaflet-tooltip {
  background: #ffffff !important;
  color: #1260cf !important;
  border: 3px solid #1260cf !important;
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
  font-weight: 600;
  box-shadow: 0 4px 10px rgba(18, 96, 207, 0.25);
}

.leaflet-tooltip-bottom:before {
  display: none;
}

.leaflet-popup-content-wrapper {
  background: #ffffff !important;
  color: #1260cf !important;
  border: 3px solid #1260cf !important;
  border-radius: 999px;
  font-weight: 500;

  box-shadow: 0 4px 10px rgba(18, 96, 207, 0.25);
}

.leaflet-popup-tip-container {
  display: none;
}

.leaflet-popup-content {
  margin: 4px 4px !important;
}

.leaflet-popup-content .popup-content .popup-header {
  font-size: 0.7rem !important;
}

.alert-cell {
  background-color: #ffefef !important;
  color: #b91c1c !important;
  font-weight: 700 !important;
}

.metric-cell--stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  line-height: 1.1;
}

.metric-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.58rem;
  font-weight: 700;
  line-height: 1;
  padding: 0.12rem 0.35rem;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.metric-badge--early {
  color: #0f766e;
  background: rgba(20, 184, 166, 0.12);
  border-color: rgba(20, 184, 166, 0.35);
}

.metric-value {
  font-size: inherit;
  line-height: inherit;
}

/* ===== 반응형 레이아웃 ===== */
@media (max-width: 920px) {
  body {
    height: auto;
    overflow: auto;
  }

  main {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto;
    grid-template-areas:
      "port-list"
      "map"
      "chart"
      "table";
    gap: 1.3rem;
    padding: 1.3rem;
    height: auto;
  }
  .map-panel,
  .port-list,
  .chart-panel,
  .table-panel {
    box-shadow: none;
    background: none;
    border-radius: 0;
    padding: 0;
    height: auto;
  }

  /* 모바일에서는 table-panel 높이가 auto라 내부 .port-table의 flex:1이 0으로 눌릴 수 있어
     표 영역이 항상 보이도록 자연 높이(+스크롤)로 전환 */
  .table-panel {
    display: block;
  }

  .table-panel .port-table {
    flex: 0 0 auto;
    max-height: 60vh;
  }

  .port-title-flag {
    width: 32px;
    height: 20px;
  }

  .port-button {
    font-size: 0.7rem;
  }

  .port-list-control-button {
    width: 20px;
    height: 20px;
    border-radius: 6px;
  }

  .port-list-header__left h2 {
    height: 20px;
    line-height: 20px;
  }

  .chart-panel__header {
    align-items: stretch;
  }

  #chartTitle.chart-panel__title {
    width: 100%;
  }

  
  .chart-title__line1 {
    display: none;
  }


  #chartDateRange {
    display: none;
  }

  /* 모바일 헤더는 title이 100%라 단위 텍스트는 기본 숨김(원하면 표시 위치 조정 가능) */
  #chartUnit {
    display: none;
  }

  .chart-legend {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 100%;
    margin: 0.2rem 0 0.5rem;
  }

  .chart-legend__group {
    gap: 0.35rem 0.6rem;
    align-items: flex-start;
  }

  .chart-legend__group--left {
    display: flex;
    flex-direction: column;
  }

  .chart-legend__text {
    font-size: 0.7rem;
    font-weight: 400;
    max-width: min(44vw, 180px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}