/* 앱 전용 스타일 — 색·간격·모서리는 vendor/studio.css 의 --ds-* 토큰만 쓴다(다크 모드 자동). */

:root {
  --ds-max: 960px; /* 띠·본문이 같은 왼쪽 선과 폭을 쓴다 */
}
[hidden] { display: none !important; }

/* 상단 이동 줄: 띠 위에 살짝 겹치는 흰 면, 탭 2개 + 예시 버튼 */
.ds-status { margin: 0 0 12px; }
.ds-status:empty { display: none; }
.ds-status-warn { background: var(--ds-warn-soft); color: var(--ds-warn); }
/* 띠 안 여백: 답 카드(-64px 올림)가 헤더(p=40px+내용)를 뒤덮지 않도록
   카드가 올라오는 64px보다 넉넉히. 헤더의 안내 문구가 띠에 절반가량 가려지던 문제. */
.ds-band:has(+ .ds-page) { padding-bottom: 112px; }
.ds-band + .ds-page { padding-top: 0; }
.top-row {
  position: relative;
  margin: -32px 0 24px;
  padding: 4px 8px;
  gap: 4px 8px;
  background: var(--ds-surface);
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius-l);
}
.top-row #nav-calc-button,
.top-row #nav-manage-button {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--ds-ink-2);
  font-weight: 600;
  padding: 0 12px;
}
.top-row #nav-calc-button[aria-pressed="true"],
.top-row #nav-manage-button[aria-pressed="true"] {
  color: var(--ds-accent-text);
  border-bottom-color: var(--ds-accent-text);
  background: transparent;
}
.top-row #try-example-button {
  margin-left: auto;
  border: 1px solid var(--ds-accent-line);
  color: var(--ds-accent-text);
}
.top-row .ds-btn { min-height: 44px; width: auto; }

/* 답 카드 */
.ds-answer-num small {
  font-size: 20px;
  font-weight: 600;
  color: var(--ds-ink-2);
}
.ds-answer-label { font-size: 14px; color: var(--ds-ink-2); }
.ds-answer-meta { display: grid; grid-template-columns: repeat(3, 1fr); padding: var(--ds-s3) 0; }
.ds-answer-meta dd { font-size: 16px; font-variant-numeric: tabular-nums; }
.ds-answer .ds-badge-warn { margin-top: 12px; font-size: 13px; }

/* 환율 카드 */
.fx-row { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; }
.fx-ref-top { align-items: flex-start; }
.fx-header {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--ds-ink);
  font-variant-numeric: tabular-nums;
}
.fx-ref { flex: none; display: flex; flex-direction: column; gap: 6px; margin-left: auto; }
.fx-ref-row { flex-wrap: nowrap; }
.fx-ref-row .ds-input { width: 170px; }
.fx-note { margin: 10px 0 0; font-size: 14px; color: var(--ds-ink-2); }
#fx-ref-today { min-height: 44px; }

/* 구역 제목·카드 */
.ds-section-title p { font-size: 14px; color: var(--ds-ink-2); max-width: 56ch; }
.ds-section-title h2 { font-size: 20px; font-weight: 800; }
.ds-card { margin-bottom: 16px; }
.ds-card h2 { color: var(--ds-ink); }
.ds-card-tint { margin-bottom: 16px; }
.ds-card-tint p { margin: 4px 0 0; font-size: 14px; color: var(--ds-ink-2); }
.ds-stack { display: flex; flex-direction: column; }
.ds-stack > * + * { margin-top: 0; }
.ds-stack { gap: 12px; }
.ds-input { border-radius: var(--ds-radius); font-size: 16px; }
.ds-label { font-size: 14px; }
.ds-hint { font-size: 14px; color: var(--ds-ink-2); }

/* 목록 */
.ds-list-item { border-bottom: 1px solid var(--ds-line); }
.ds-list-item:last-child { border-bottom: 0; }
.ds-list-sub { font-size: 14px; color: var(--ds-ink-2); }
.ds-list-end { display: flex; align-items: center; gap: 8px; }
.ds-list-amount { font-size: 16px; }
.plan-month-note { font-size: 14px; color: var(--ds-ink-2); }
.plan-remove {
  flex: none;
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  border-radius: var(--ds-radius);
  display: grid;
  place-items: center;
  color: var(--ds-ink-2);
  cursor: pointer;
  transition: background-color .15s ease-out, transform .15s ease-out;
}
.plan-remove:hover { background: var(--ds-surface-2); color: var(--ds-ink); }
.plan-remove:active { transform: scale(.97); }
.plan-remove svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2; fill: none; }
.ds-empty { padding: 16px 0; border: 0; font-size: 14px; color: var(--ds-ink-2); }

/* 첫 줄 요약·증감 */
.first-banner {
  margin: 12px 0 0;
  padding: 10px 12px;
  background: var(--ds-surface-2);
  border-radius: var(--ds-radius);
  font-size: 14px;
  color: var(--ds-ink);
}
.first-banner:empty { display: none; }
.diff-up { color: var(--ds-up); font-weight: 700; }
.diff-down { color: var(--ds-down); font-weight: 700; }
.diff-even { color: var(--ds-ink-2); font-weight: 700; }

.baseline-row { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--ds-line); gap: 8px 12px; }
.baseline-row .ds-label { margin: 0; }
.baseline-row .ds-input { width: 120px; }

/* CHANGES #5: 기준 환율 입력 오류 스타일 */
input[aria-invalid="true"] {
  border-color: var(--ds-down);
  background: var(--ds-down-soft);
}

/* 검색·칩. 칩이 카드 폭을 넘어가면 안 되므로(오른쪽 가장자리가 잘려 나감)
   카드 안쪽 폭을 재껴서(양쪽 패딩만큼) 가로 스크롤 박스로 감싼다. */
.ds-card { overflow: hidden; }
.ds-chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  list-style: none;
  padding: 0 0 4px;
  margin: 0 calc(-1*var(--ds-s5));
  scrollbar-width: thin;
}
.plan-chip-hint { margin: 0; }
.plan-chip { flex: none; }
.ds-chip {
  min-height: 44px;
  padding: 0 14px;
  white-space: nowrap;
  border-radius: var(--ds-radius);
  display: flex;
  align-items: center;
  gap: 6px;
}
.ds-chip:has(input:checked) {
  background: var(--ds-accent-soft);
  border-color: var(--ds-accent-text);
  color: var(--ds-accent-text);
  font-weight: 600;
}
.ds-chip input { display: none; }
.ds-chip::before {
  content: "";
  flex: none;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--ds-ink-3);
  border-radius: 4px;
  transition: background-color .15s ease-out, border-color .15s ease-out;
}
.ds-chip:has(input:checked)::before {
  background-color: var(--ds-accent-text);
  border-color: var(--ds-accent-text);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='4'%3E%3Cpath d='M5 13l4 4L19 7'/%3E%3C/svg%3E");
  background-size: 11px;
  background-position: center;
  background-repeat: no-repeat;
}

/* CHANGES #2: EXTRA_SERVICES chips ("+ 추가" 버튼 스타일) */
.plan-add-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 14px;
  white-space: nowrap;
  border-radius: var(--ds-radius);
  background: var(--ds-surface-2);
  border: 1px dashed var(--ds-line);
}
.plan-add-btn {
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
  border-radius: 8px;
  border: 1px solid var(--ds-accent-line);
  color: var(--ds-accent-text);
  background: transparent;
  cursor: pointer;
  font-weight: 500;
}
.plan-add-btn:hover {
  background: var(--ds-accent-soft);
}
.plan-add-btn:active {
  transform: scale(.97);
}
.plan-add-btn:focus-visible {
  outline: 2px solid var(--ds-focus);
  outline-offset: 2px;
}

/* 접힌 구역: studio.css 의 [hidden]{display:none!important} 규칙이 닫힌 <details> 내부 콘텐츠에
   붙은 원시 hidden 속성만 표적화해, 브라우저가 닫은 내용을 숨기는 content-visibility:hidden 을
   덮어쓰는 바람에 카드(#coin-section·#fx-data-meta)가 닫혀도 보이는 상태로 남고,
   summary·푸터 글자와 겹치던 문제를 고친다.
   display:none(중요도 낮춤) → content-visibility:hidden → display:block(열림) 순으로
   열렸을 때만 표시되고, 닫힌 카드의 인가 박스(빈 64px li)도 함께 사라진다. */
details:not([open]) .ds-card { display: none; }
#coin-section { display: none; }
#coin-section-details[open] #coin-section { display: block; }
#fx-data-meta { display: none; }
#data-meta-details[open] #fx-data-meta { display: block; }
#coin-section-details { margin-bottom: 20px; }
#data-meta-details { margin-bottom: 0; }
.coin-summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  background: var(--ds-surface);
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius);
  cursor: pointer;
  font-size: 14px;
  color: var(--ds-ink-2);
}
#coin-section { margin-bottom: 0; }
#coin-section .ds-list-item { font-size: 14px; }
#fx-data-meta { white-space: pre-line; font-size: 14px; color: var(--ds-ink-2); line-height: 1.6; margin-bottom: 16px; }

/* 저장·내보내기 */
.summary-text { margin: 8px 0 12px; }
.summary-json-details summary { cursor: pointer; font-size: 14px; color: var(--ds-ink-2); min-height: 44px; display: flex; align-items: center; }
.ds-json {
  margin: 8px 0 0;
  padding: 12px;
  background: var(--ds-surface-2);
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius);
  font-size: 14px;
  overflow: auto;
  max-height: 320px;
}

.ds-footer { font-size: 14px; text-align: left; display: flex; flex-direction: column; gap: 4px; }

/* 키보드 포커스 */
button:focus-visible, summary:focus-visible, .ds-chip:has(input:focus-visible) {
  outline: 2px solid var(--ds-focus);
  outline-offset: 2px;
}

/* 휴대폰 */
@media (max-width: 600px) {
  .ds-answer-meta { grid-template-columns: 1fr 1fr; gap: 12px 0; }
  .ds-answer-meta > div { padding: 0 var(--ds-s3); }
  .ds-answer-meta > div + div { border-left: 0; }
  .ds-answer-meta > div:nth-child(2) { border-left: 1px solid var(--ds-line); }
  .ds-answer-meta > div:nth-child(3) { grid-column: 1 / -1; border-top: 1px solid var(--ds-line); padding-top: 12px; }
  .ds-answer-meta dd { white-space: normal; overflow-wrap: anywhere; }
  .ds-answer-text { font-size: 15px; }
  .top-row #try-example-button { flex: 1 1 100%; margin-left: 0; }
  .top-row #nav-calc-button, .top-row #nav-manage-button { flex: 1 1 0; padding: 0 4px; }
  .fx-ref { margin-left: 0; width: 100%; align-items: stretch; }
  .fx-ref-row .ds-input { flex: 1; width: auto; min-width: 0; }
  .ds-label { text-align: left; }
  .ds-list-item { gap: 10px; }
  .ds-list-end { gap: 4px; }
  .baseline-row .ds-input { width: 100px; }
}
