/*
 * HealthLog 2.0 — Phase 0/1 화면 스타일. 전부 html.ui2 아래에 있어서, 새 화면을 끄면 아무 영향이 없다.
 *
 * 기준: 본문 16px, 보조 글씨 13px 이상, 주요 터치 영역 44px 이상(대부분 48px), 보조 글씨 대비 4.5:1 이상,
 * 상태는 색뿐 아니라 글자·기호·모양으로도 전달한다. 높이는 고정하지 않고 min-height로 둔다(글꼴 배율 대응).
 */

/* ---------------------------------------------------------------- 토큰(대비 보정) */
html.ui2 {
  --ui2-tab-h: 64px;
  --ui2-on-teal: #ffffff;
  --muted: #566070;
  --faint: #5b6574;
  --teal-strong: #0b6b63;
  --amber: #8a5a00;
  --red: #a8300c;
  --green: #157a38;
  --blue: #1d4ed8;
  /* 당겨서 새로고침으로 앱이 다시 시작되는 일을 막는다. 스크롤 자체는 그대로 동작한다. */
  overscroll-behavior-y: contain;
}
html.ui2[data-theme="dark"] {
  --ui2-on-teal: #04201c;
  --muted: #a3adbd;
  --faint: #98a2b3;
  --teal-strong: #2dd4bf;
  --amber: #fbbf24;
  --red: #f87171;
  --green: #4ade80;
  --blue: #60a5fa;
}
html.ui2 body {
  /* styles.css gives html AND body overflow-x:hidden, which turns body into a scroll container and breaks
     position:sticky (sub-page header). html keeps the horizontal clamp for the whole page. */
  overflow: visible;
  overscroll-behavior-y: contain;
  font-size: 16px;
  line-height: 1.5;
}

/* ---------------------------------------------------------------- 이전 화면의 틀은 숨긴다 */
html.ui2 .topbar,
html.ui2 .side-nav,
html.ui2 .bottom-nav,
html.ui2 #dashboardView,
html.ui2 #sleepImportNotice {
  display: none !important;
}
html.ui2 .workspace {
  display: block;
}
html.ui2 .main-content {
  max-width: 720px;
  margin-inline: auto;
  padding: 14px 16px calc(var(--ui2-tab-h) + 104px + env(safe-area-inset-bottom));
}

/* ---------------------------------------------------------------- 하단 4탭: 항상 보이고, 접히지 않는다 */
.ui2-tabbar {
  display: none;
}
html.ui2 .ui2-tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 16px rgba(23, 27, 33, 0.07);
  padding-bottom: env(safe-area-inset-bottom);
}
.ui2-tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: var(--ui2-tab-h);
  min-width: 44px;
  padding: 6px 4px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.ui2-tab-label {
  font-size: 13px;
  line-height: 1.2;
}
/* 선택 표시는 색만이 아니라 배경·윗줄·굵기로도 구별한다 */
.ui2-tab.active {
  color: var(--teal-strong);
  background: var(--teal-soft);
  font-weight: 800;
}
.ui2-tab.active::before {
  content: "";
  position: absolute;
  top: 0;
  left: 18%;
  right: 18%;
  height: 4px;
  border-radius: 0 0 4px 4px;
  background: var(--teal-strong);
}

/* ---------------------------------------------------------------- 공통 */
.ui2-view {
  padding: 0;
}
.ui2-header {
  padding: 4px 2px 14px;
}
.ui2-header h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.25;
  letter-spacing: -0.5px;
}
.ui2-header h1:focus {
  outline: none;
}
.ui2-status {
  margin: 6px 0 0;
  font-size: 14px;
  color: var(--muted);
}
.ui2-meta {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.ui2-btn {
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.ui2-btn-primary {
  background: var(--teal-strong);
  border-color: var(--teal-strong);
  color: var(--ui2-on-teal);
}

/* ---------------------------------------------------------------- 홈 */
.ui2-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  width: 100%;
  margin: 0 0 14px;
  padding: 18px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  color: var(--text);
  font: inherit;
}
.ui2-card-btn {
  cursor: pointer;
}
.ui2-card-btn:active {
  background: var(--surface-muted);
}
.ui2-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--muted);
}
.ui2-bp-value,
.ui2-sleep-value {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
}
.ui2-bp-value strong,
.ui2-sleep-value strong {
  font-size: 36px;
  line-height: 1.12;
  font-weight: 800;
  letter-spacing: -1px;
}
.ui2-bp-value small {
  font-size: 14px;
  color: var(--muted);
}
.ui2-pulse {
  font-size: 16px;
}
.ui2-pulse b {
  font-size: 20px;
}
.ui2-source {
  font-size: 14px;
  font-weight: 700;
  color: var(--teal-strong);
}
/* 변화는 기호(▲▼＝)와 글자로 말한다. 좋고 나쁨을 색으로 판정하지 않는다. */
.ui2-compare {
  display: inline-block;
  margin-top: 2px;
  padding: 6px 10px;
  border-radius: 10px;
  background: var(--surface-muted);
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
}
.ui2-note {
  font-size: 13px;
  color: var(--muted);
}
.ui2-others {
  padding: 6px 18px;
}
.ui2-other-list {
  margin: 0;
  padding: 0;
  list-style: none;
  width: 100%;
}
.ui2-other-row {
  display: grid;
  gap: 2px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-soft);
}
.ui2-other-row:last-child {
  border-bottom: 0;
}
.ui2-other-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
}
.ui2-other-value {
  font-size: 20px;
  font-weight: 800;
}
.ui2-empty-title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
}

/* "＋ 기록하기": 하단 탭 바로 위에 고정된 영역. 본문은 이 영역 위까지만 보이므로 카드를 가리지 않는다. */
.ui2-action-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--ui2-tab-h) + env(safe-area-inset-bottom));
  z-index: 90;
  display: flex;
  justify-content: center;
  padding: 8px 16px 10px;
  background: var(--bg);
}
.ui2-primary {
  width: 100%;
  max-width: 688px;
  min-height: 56px;
  border: 0;
  border-radius: 16px;
  background: var(--teal-strong);
  color: var(--ui2-on-teal);
  font: inherit;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(11, 107, 99, 0.28);
}

/* 알림: 한 번에 하나, 행동이 필요할 때만 */
.ui2-notice {
  margin: 0 0 14px;
  padding: 14px 16px;
  background: var(--amber-soft);
  border: 1px solid var(--border);
  border-left: 5px solid var(--amber);
  border-radius: 14px;
}
.ui2-notice-text {
  margin: 0 0 10px;
  font-size: 15px;
  line-height: 1.5;
}
.ui2-notice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---------------------------------------------------------------- 내 정보 */
.ui2-block {
  margin: 0 0 22px;
}
.ui2-block h2 {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 800;
  color: var(--muted);
}
.ui2-trio {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.ui2-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 60px;
  margin: 0 0 8px;
  padding: 10px 16px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.ui2-row-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 16px;
  font-weight: 700;
}
.ui2-row-main small {
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
}
.ui2-chev {
  font-size: 24px;
  color: var(--muted);
}
.ui2-facts {
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.ui2-facts li {
  display: grid;
  gap: 2px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 15px;
}
.ui2-facts li:last-child {
  border-bottom: 0;
}
.ui2-fact-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
}
.ui2-subbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  margin: 0 0 6px;
  background: var(--bg);
}
.ui2-back {
  min-width: 48px;
  min-height: 48px;
  padding: 0 14px 0 6px;
  border: 0;
  background: transparent;
  color: var(--teal-strong);
  font: inherit;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}
.ui2-subtitle {
  font-size: 15px;
  font-weight: 700;
  color: var(--muted);
}

/* ---------------------------------------------------------------- 기존 화면(기록·추세·하위 화면)의 최소 접근성 보정 */
html.ui2 .segmented {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 6px;
}
html.ui2 .segmented button {
  display: flex !important;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  font-size: 15px;
}
html.ui2 .segmented button.active::after {
  content: none !important;
}
html.ui2 .button,
html.ui2 .icon-button,
html.ui2 .compact-select {
  min-height: 48px;
  height: auto;
}
html.ui2 .button.small {
  min-height: 44px;
  height: auto;
  font-size: 14px;
}
html.ui2 .delete-btn {
  width: 44px;
  height: 44px;
  font-size: 18px;
}
html.ui2 input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]),
html.ui2 select,
html.ui2 textarea {
  min-height: 48px;
}
html.ui2 .toggle-label {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  font-size: 14px;
}
html.ui2 .toggle-label input[type="checkbox"] {
  width: 24px;
  height: 24px;
  flex: none;
}
html.ui2 .period-switch button {
  min-height: 44px;
  min-width: 56px;
  font-size: 14px;
}
html.ui2 .source-badge,
html.ui2 .timing-badge,
html.ui2 .risk-badge,
html.ui2 .status-pill,
html.ui2 .type-badge,
html.ui2 .muted-inline,
html.ui2 .empty-state,
html.ui2 .device-note,
html.ui2 .panel-header span,
html.ui2 .metric-card small,
html.ui2 small {
  font-size: 13px;
}
html.ui2 .eyebrow,
html.ui2 .activity-day,
html.ui2 .quick-heading > span,
html.ui2 .insights-toolbar p {
  font-size: 13px;
}
/* 표는 한 글자씩 줄바꿈하지 않고, 표 안에서 가로로 스크롤한다(카드형 목록은 Phase 2) */
html.ui2 .data-table {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
html.ui2 .data-table th,
html.ui2 .data-table td {
  white-space: nowrap;
  font-size: 13.5px;
}
html.ui2 summary {
  display: list-item;
  min-height: 44px;
  padding-block: 12px;
  cursor: pointer;
}
html.ui2 .toast {
  bottom: calc(var(--ui2-tab-h) + 84px + env(safe-area-inset-bottom));
}
html.ui2 .confirm-actions .button {
  min-height: 52px;
}

/* 좁은 화면(320px) */
@media (max-width: 359px) {
  .ui2-trio {
    grid-template-columns: 1fr;
  }
  .ui2-bp-value strong,
  .ui2-sleep-value strong {
    font-size: 32px;
  }
  .ui2-header h1 {
    font-size: 24px;
  }
}
/* 넓은 화면(태블릿)에서는 하단 탭도 본문 폭에 맞춘다 */
@media (min-width: 721px) {
  html.ui2 .ui2-tabbar {
    left: 50%;
    right: auto;
    width: 720px;
    transform: translateX(-50%);
    border-radius: 16px 16px 0 0;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }
}

/* 화면 제목은 탭을 옮길 때 스크린리더 안내용으로 포커스만 받는다(조작 대상이 아니므로 테두리를 그리지 않는다). */
html.ui2 h1:focus,
html.ui2 h1:focus-visible {
  outline: none;
}

/* ================================================================ Phase 2 — 기록 타임라인 · 기록 추가 · 상세 · 수정 */
html.ui2 .ui2-view button:focus-visible,
html.ui2 .ui2-overlay button:focus-visible,
html.ui2 .ui2-overlay .ui2-input:focus-visible,
html.ui2 .ui2-snack button:focus-visible,
html.ui2 .ui2-overlay summary:focus-visible {
  outline: 3px solid var(--teal-strong);
  outline-offset: 2px;
}

/* 필터 칩: 데이터가 있는 종류만 */
.ui2-filters,
.ui2-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}
.ui2-filters:empty {
  display: none;
}
.ui2-chip {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
/* 선택은 색뿐 아니라 체크 표시로도 구별한다 */
.ui2-chip[aria-pressed="true"] {
  background: var(--teal-strong);
  border-color: var(--teal-strong);
  color: var(--ui2-on-teal);
}
.ui2-chip[aria-pressed="true"]::before {
  content: "✓ ";
}
.ui2-chip-more {
  border-style: dashed;
  color: var(--muted);
}

/* 타임라인 */
.ui2-day {
  margin: 0 0 18px;
}
.ui2-day h2 {
  margin: 0 0 8px;
  padding: 0 2px;
  font-size: 15px;
  font-weight: 800;
  color: var(--muted);
}
.ui2-rec-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}
.ui2-rec {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  width: 100%;
  min-height: 64px;
  padding: 12px 12px 12px 14px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.ui2-rec:active {
  background: var(--surface-muted);
}
.ui2-rec-time {
  padding-top: 2px;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  line-height: 1.35;
}
.ui2-rec-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.ui2-rec-kind {
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
}
.ui2-rec-value strong {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.ui2-rec-value small {
  font-size: 13px;
  color: var(--muted);
}
.ui2-rec-sub {
  font-size: 15px;
}
.ui2-rec-src {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  font-size: 14px;
}
.ui2-src-name {
  font-weight: 700;
  color: var(--teal-strong);
}
.ui2-tag {
  padding: 1px 8px;
  border-radius: 8px;
  background: var(--surface-muted);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}
.ui2-rec .ui2-chev {
  align-self: center;
}
.ui2-more-btn {
  width: 100%;
  margin: 4px 0 18px;
}
.ui2-empty {
  display: grid;
  gap: 10px;
  justify-items: start;
  padding: 28px 4px;
}

/* 겹침 화면: 하단 탭 위를 덮는다(탭은 계속 보인다) */
.ui2-overlay-layer {
  display: none;
}
html.ui2 .ui2-overlay-layer.open {
  display: block;
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  bottom: var(--ui2-ov-bottom, calc(var(--ui2-tab-h) + env(safe-area-inset-bottom)));
  z-index: 95;
  background: var(--bg);
}
.ui2-overlay {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  box-sizing: border-box;
  max-width: 720px;
  margin-inline: auto;
  padding: 8px 16px 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.ui2-overlay[hidden] {
  display: none;
}
/* 아래 여백은 padding이 아니라 끝의 빈 칸으로 둔다 — padding이면 고정 저장 바 아래로 내용이 비쳐 보인다 */
.ui2-overlay::after {
  content: "";
  display: block;
  min-height: 24px;
}
.ui2-ovbar {
  position: static;
  margin-bottom: 4px;
}
.ui2-ov-title {
  margin: 4px 2px 12px;
  font-size: 26px;
  line-height: 1.25;
  letter-spacing: -0.5px;
}
.ui2-ov-title:focus {
  outline: none;
}

/* 입력 폼 */
.ui2-form {
  display: grid;
  gap: 4px;
}
.ui2-field {
  display: grid;
  gap: 6px;
  margin: 0 0 12px;
}
.ui2-label {
  font-size: 15px;
  font-weight: 700;
}
.ui2-unit {
  font-weight: 400;
  color: var(--muted);
}
.ui2-req {
  margin-left: 4px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.ui2-input {
  box-sizing: border-box;
  width: 100%;
  min-height: 52px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 18px;
}
textarea.ui2-input {
  min-height: 84px;
  resize: vertical;
}
.ui2-input[aria-invalid="true"] {
  border: 2px solid var(--red);
}
.ui2-error {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--red);
}
.ui2-error::before {
  content: "⚠ ";
}
.ui2-hint {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}
.ui2-label-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 2.9em;
}
.ui2-label-stack .ui2-unit {
  font-size: 13px;
  min-height: 1.2em;
}
.ui2-grid3 {
  align-items: start;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.ui2-grid3 .ui2-input {
  padding-inline: 8px;
  font-size: 22px;
  font-weight: 800;
  text-align: center;
}
.ui2-when {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 52px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
}
.ui2-when-edit {
  font-size: 14px;
  font-weight: 600;
  color: var(--teal-strong);
}
.ui2-scale {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}
.ui2-scale-btn {
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
}
.ui2-scale-btn[aria-pressed="true"] {
  background: var(--teal-strong);
  border-color: var(--teal-strong);
  color: var(--ui2-on-teal);
}
.ui2-more {
  margin: 4px 0 12px;
  padding: 0 14px 6px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}
.ui2-more > summary {
  font-size: 16px;
  font-weight: 700;
  color: var(--teal-strong);
}
.ui2-more[open] > summary {
  margin-bottom: 6px;
}
/* 저장 버튼은 항상 화면 아래쪽에 남는다(키보드가 올라오면 겹침 화면 자체가 키보드 위로 올라온다) */
.ui2-save-bar {
  position: sticky;
  bottom: 0;
  z-index: 5;
  padding: 10px 0 12px;
  background: var(--bg);
}
.ui2-save {
  width: 100%;
  max-width: none;
}
.ui2-save:disabled {
  opacity: 0.6;
}

/* 상세 */
.ui2-hero {
  margin: 0 0 16px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
}
.ui2-hero p {
  margin: 0;
}
.ui2-hero-value strong {
  font-size: 38px;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}
.ui2-hero-value small {
  font-size: 15px;
  color: var(--muted);
}
.ui2-hero-sub {
  margin-top: 4px !important;
  font-size: 17px;
}
.ui2-hero-time {
  margin-top: 8px !important;
  font-size: 15px;
  color: var(--muted);
}
.ui2-src-box .ui2-src-line {
  margin: 0 0 4px;
  font-size: 17px;
}
.ui2-auto-note {
  margin: 8px 0;
  padding: 10px 12px;
  border-left: 5px solid var(--amber);
  border-radius: 10px;
  background: var(--amber-soft);
  font-size: 14px;
  line-height: 1.5;
}
.ui2-dl {
  display: block;
}
.ui2-dl > div {
  display: grid;
  grid-template-columns: minmax(96px, 36%) minmax(0, 1fr);
  gap: 10px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 15px;
}
.ui2-dl > div:last-child {
  border-bottom: 0;
}
.ui2-dl dt {
  font-weight: 700;
  color: var(--muted);
}
.ui2-dl dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.ui2-memo {
  margin: 0;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 15px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.ui2-memo-auto {
  color: var(--muted);
  font-size: 14px;
}
.ui2-detail-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 8px 0 10px;
}
.ui2-btn-danger {
  border-color: var(--red);
  color: var(--red);
}
.ui2-delete-note {
  margin: 0 0 6px;
}

/* 삭제 후 실행 취소 알림 */
.ui2-snack {
  position: fixed;
  left: 50%;
  bottom: calc(var(--ui2-tab-h) + 88px + env(safe-area-inset-bottom));
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-sizing: border-box;
  width: calc(100% - 32px);
  max-width: 560px;
  min-height: 56px;
  padding: 6px 8px 6px 16px;
  transform: translateX(-50%);
  border-radius: 14px;
  background: #1f2937;
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}
.ui2-snack[hidden] {
  display: none;
}
.ui2-snack-text {
  font-size: 15px;
  font-weight: 600;
}
.ui2-snack-btn {
  min-width: 96px;
  min-height: 48px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #7ee7d9;
  font: inherit;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}

/* 좁은 화면(320px)·가로 화면 */
@media (max-width: 359px) {
  .ui2-rec {
    grid-template-columns: 52px minmax(0, 1fr) auto;
    gap: 8px;
  }
  .ui2-detail-actions {
    grid-template-columns: 1fr;
  }
}
@media (orientation: landscape) and (max-height: 500px) {
  .ui2-overlay {
    padding-top: 2px;
  }
  .ui2-ov-title {
    font-size: 22px;
    margin-bottom: 6px;
  }
}

/* ================================================================ Phase 3 — 추세 · 지표 상세 */
#ui2LegacyCharts[hidden] {
  display: none !important;
}
.ui2-lead {
  margin: 0 2px 12px;
}
.ui2-periods,
.ui2-scopebar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}
.ui2-metric-card {
  gap: 4px;
}
.ui2-trend-headline,
.ui2-sum-headline {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.3;
  margin: 0;
}
.ui2-more-link {
  margin-top: 6px;
  font-size: 15px;
  font-weight: 700;
  color: var(--teal-strong);
}
.ui2-summary p,
.ui2-latest p,
.ui2-pulse-block p {
  margin: 0 0 6px;
}
.ui2-latest strong {
  font-size: 26px;
}
.ui2-hint {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--muted);
}
.ui2-figure {
  margin: 0 0 8px;
  padding: 10px 6px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
}
.ui2-figure figcaption {
  padding: 4px 8px 0;
}
.ui2-chart {
  display: block;
  width: 100%;
  height: auto;
  touch-action: pan-y;
}
.ui2-chart .ui2-grid {
  stroke: var(--border);
  stroke-width: 1;
}
.ui2-chart .ui2-axis {
  fill: var(--muted);
  font-size: 12px;
}
.ui2-chart .ui2-line {
  fill: none;
  stroke-width: 2.4;
  stroke-linejoin: round;
}
.ui2-chart .s1 { stroke: var(--teal-strong); }
.ui2-chart .s2 { stroke: var(--blue); stroke-dasharray: 6 4; }
.ui2-chart .s3 { stroke: var(--amber); }
.ui2-chart .ui2-dot.s1 { fill: var(--teal-strong); stroke: none; }
.ui2-chart .ui2-dot.s2 { fill: var(--blue); stroke: none; }
.ui2-chart .ui2-dot.s3 { fill: var(--amber); stroke: none; }
.ui2-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 6px 8px 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
  color: var(--muted);
}
.ui2-legend li {
  display: flex;
  align-items: center;
  gap: 6px;
}
.ui2-key {
  display: inline-block;
  width: 22px;
  border-top: 3px solid var(--teal-strong);
}
.ui2-key.s2 { border-top: 3px dashed var(--blue); }
.ui2-key.s3 { border-top: 3px solid var(--amber); }
.ui2-readout {
  margin: 0 0 14px;
}
.ui2-readout-text {
  min-height: 44px;
  margin: 8px 2px;
  font-size: 15px;
  font-weight: 600;
}
.ui2-stepper {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ui2-tablewrap {
  margin: 0 0 18px;
}
.ui2-table-toggle {
  width: 100%;
}
.ui2-table-scroll {
  margin-top: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.ui2-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.ui2-table caption {
  padding: 10px 12px;
  text-align: left;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}
.ui2-table th,
.ui2-table td {
  padding: 8px 10px;
  text-align: left;
  vertical-align: middle;
  border-top: 1px solid var(--border-soft);
  white-space: nowrap;
}
.ui2-table thead th {
  font-size: 13px;
  color: var(--muted);
}
.ui2-table tbody th {
  font-weight: 700;
}
.ui2-table-actions {
  display: flex;
  gap: 6px;
}
.ui2-table-btn {
  min-width: 56px;
  padding: 0 10px;
  font-size: 14px;
}
.ui2-plain {
  margin: 0;
  padding: 0 0 6px 18px;
  font-size: 14px;
  line-height: 1.6;
}
.ui2-info {
  margin-top: 8px;
}
@media (max-width: 359px) {
  .ui2-trend-headline,
  .ui2-sum-headline {
    font-size: 20px;
  }
}
/* 표가 가로로 넓어도 날짜(첫 열)는 항상 보이게 한다 */
.ui2-table tbody th,
.ui2-table thead th:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface);
}
/* 표가 가로로 넓어도 날짜(첫 열)는 항상 보이게 한다 */
.ui2-table tbody th,
.ui2-table thead th:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface);
}
