/* ===========================================================
   아리 — 설정(settings) 페이지 스타일
   전부 .settingspage 스코프 (전역 클래스 충돌 회피).
   토큰(--glass/--blur/--glass-brd/--radius/--ink …)은 tokens.css 가 제공.
   커넥터 카드(cn / cs 프리픽스)는 connectors.css 가 :is(.lifepage,.settingspage) 로 공유.
   =========================================================== */

.settingspage {
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 0.4s ease,
    transform 0.4s ease;
}
.settingspage.entered {
  opacity: 1;
  transform: none;
}

/* ===== 페이지 헤더 ===== */
.settingspage .set-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 4px 22px;
}
.settingspage .sh-ic {
  width: 50px;
  height: 50px;
  flex-shrink: 0;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: var(--ink);
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--glass-brd);
  box-shadow: var(--shadow-sm), var(--glass-hi);
}
.settingspage .sh-ic .ic {
  width: 24px;
  height: 24px;
}
.settingspage .set-head h1 {
  font-family: var(--font-disp);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.settingspage .set-head p {
  margin-top: 2px;
  font-size: 13.5px;
  color: var(--muted);
}

/* ===== 레이아웃: 좌측 레일 + 메인 ===== */
.settingspage .set-work {
  display: flex;
  gap: 22px;
  align-items: flex-start;
}
.settingspage .set-rail {
  position: sticky;
  top: 86px;
  flex-shrink: 0;
  width: 232px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  border-radius: var(--radius);
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--glass-brd);
  box-shadow: var(--shadow), var(--glass-hi);
}
.settingspage .set-tab {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 11px 12px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition:
    background 0.16s ease,
    color 0.16s ease;
}
.settingspage .set-tab:hover {
  background: var(--glass-2);
}
.settingspage .set-tab.active {
  background: var(--fill);
  color: var(--on-fill);
  box-shadow: var(--shadow-sm);
}
.settingspage .st-ic {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--glass-2);
  border: 1px solid var(--line-2);
  color: inherit;
}
.settingspage .set-tab.active .st-ic {
  background: rgba(255, 255, 255, 0.12);
  border-color: transparent;
}
.settingspage .st-ic .ic {
  width: 18px;
  height: 18px;
}
.settingspage .st-txt {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}
.settingspage .st-txt b {
  font-size: 14px;
  font-weight: 700;
}
.settingspage .st-txt small {
  font-size: 11.5px;
  opacity: 0.72;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settingspage .set-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ===== 섹션 ===== */
.settingspage .set-sec {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.settingspage .set-sechead {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  padding: 2px;
}
.settingspage .set-sechead h2 {
  font-family: var(--font-disp);
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.settingspage .set-sechead p {
  flex: 1;
  min-width: 220px;
  font-size: 13px;
  color: var(--muted);
}
.settingspage .sh-side {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

/* ===== 카드 ===== */
.settingspage .set-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  border-radius: var(--radius);
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--glass-brd);
  box-shadow: var(--shadow), var(--glass-hi);
}
.settingspage .set-cardhead {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
}
.settingspage .set-cardhead h3 {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}
.settingspage .set-cardhead h3 .ic {
  width: 17px;
  height: 17px;
  color: var(--ink-2);
}

/* ===== 폼 필드 ===== */
.settingspage .set-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.settingspage .set-field-narrow {
  max-width: 220px;
}
.settingspage .set-field > label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-2);
}
.settingspage .set-input {
  width: 100%;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  padding: 11px 13px;
  border-radius: 12px;
  background: var(--card, #fff);
  border: 1px solid var(--line-2);
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}
.settingspage .set-input::placeholder {
  color: var(--faint);
}
.settingspage .set-input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(79, 114, 224, 0.18);
}
.settingspage .set-input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.settingspage .set-mono {
  font-family: var(--font-mono);
  font-size: 13px;
}
.settingspage .set-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.settingspage .set-hint {
  font-size: 12px;
  color: var(--muted);
}

/* ===== 태그/배지 ===== */
.settingspage .set-tag {
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--glass-2);
  border: 1px solid var(--line-2);
  color: var(--ink-2);
}
.settingspage .set-tag-on {
  background: color-mix(in oklab, var(--green) 18%, transparent);
  border-color: color-mix(in oklab, var(--green) 40%, transparent);
  color: var(--green);
}

/* ===== 칩(모델 목록 등) ===== */
.settingspage .set-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.settingspage .set-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  font-family: var(--font-mono);
  padding: 6px 11px;
  border-radius: 10px;
  background: var(--glass-2);
  border: 1px solid var(--line-2);
  color: var(--ink-2);
  cursor: pointer;
  transition:
    background 0.14s ease,
    color 0.14s ease;
}
.settingspage .set-chip:hover {
  background: var(--card-3, var(--glass-2));
  color: var(--ink);
}
.settingspage .set-chip.on {
  background: var(--fill);
  color: var(--on-fill);
  border-color: transparent;
}
.settingspage .set-chip .ic {
  width: 14px;
  height: 14px;
}
.settingspage .set-chip.danger {
  font-family: var(--font-ui);
  color: var(--coral);
  border-color: color-mix(in oklab, var(--coral) 32%, transparent);
}
.settingspage .set-chip.danger:hover {
  background: color-mix(in oklab, var(--coral) 12%, transparent);
  color: var(--coral);
}

/* ===== 연결 테스트 결과 ===== */
.settingspage .set-test {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  font-weight: 600;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--line-2);
}
.settingspage .set-test .ic {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}
.settingspage .set-test.ok {
  background: color-mix(in oklab, var(--green) 12%, transparent);
  border-color: color-mix(in oklab, var(--green) 34%, transparent);
  color: var(--green);
}
.settingspage .set-test.bad {
  background: color-mix(in oklab, var(--coral) 12%, transparent);
  border-color: color-mix(in oklab, var(--coral) 34%, transparent);
  color: var(--coral);
}

/* ===== key/value 목록 ===== */
.settingspage .set-kv {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px 18px;
}
.settingspage .set-kv > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.settingspage .set-kv dt {
  font-size: 12px;
  color: var(--muted);
}
.settingspage .set-kv dd {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

/* ===== 프로필 ===== */
.settingspage .set-profile {
  flex-direction: row;
  align-items: center;
  gap: 16px;
}
.settingspage .sp-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.settingspage .sp-meta > b {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}
.settingspage .sp-email {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}
.settingspage .sp-email .ic {
  width: 14px;
  height: 14px;
}
.settingspage .sp-role {
  margin-left: auto;
  align-self: flex-start;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--glass-2);
  border: 1px solid var(--line-2);
  color: var(--ink-2);
}
.settingspage .set-row-between {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

/* ===== 테마 선택 ===== */
.settingspage .set-themes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.settingspage .set-theme {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border-radius: 16px;
  background: var(--glass-2);
  border: 1.5px solid var(--line-2);
  cursor: pointer;
  text-align: left;
  transition:
    border-color 0.16s ease,
    transform 0.12s ease;
}
.settingspage .set-theme:hover {
  transform: translateY(-2px);
}
.settingspage .set-theme.on {
  border-color: var(--blue);
}
.settingspage .th-preview {
  height: 58px;
  border-radius: 11px;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
}
.settingspage .th-light .th-preview {
  background: linear-gradient(135deg, #f6efe7, #e9ebed);
}
.settingspage .th-dark .th-preview {
  background: linear-gradient(135deg, #201d1a, #161413);
}
.settingspage .th-bar {
  position: absolute;
  left: 10px;
  top: 12px;
  width: 56%;
  height: 8px;
  border-radius: 4px;
  background: var(--lime);
}
.settingspage .th-dot {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--coral), var(--violet));
}
.settingspage .th-label {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.settingspage .th-label .ic {
  width: 16px;
  height: 16px;
  color: var(--ink-2);
}
.settingspage .th-label b {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}
.settingspage .th-label small {
  font-size: 12px;
  color: var(--muted);
}
.settingspage .th-check {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--blue);
  color: #fff;
}
.settingspage .th-check .ic {
  width: 13px;
  height: 13px;
}

/* ===== 토큰 ===== */
.settingspage .set-tokenform {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.settingspage .set-tokenform .set-input {
  flex: 1;
  min-width: 200px;
}
.settingspage .set-reveal {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: 14px;
  background: color-mix(in oklab, var(--amber) 10%, transparent);
  border: 1px solid color-mix(in oklab, var(--amber) 34%, transparent);
}
.settingspage .sr-head {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--ink);
}
.settingspage .sr-head .ic {
  width: 15px;
  height: 15px;
}
.settingspage .sr-token {
  font-family: var(--font-mono);
  font-size: 13px;
  word-break: break-all;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--card, #fff);
  border: 1px solid var(--line-2);
  color: var(--ink);
}
.settingspage .sr-actions {
  display: flex;
  gap: 8px;
}
.settingspage .set-tokenlist {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.settingspage .set-tokenlist li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 13px;
  border-radius: 12px;
  background: var(--glass-2);
  border: 1px solid var(--line-2);
}
.settingspage .tk-ic {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--card, #fff);
  border: 1px solid var(--line-2);
  color: var(--ink-2);
}
.settingspage .tk-ic .ic {
  width: 16px;
  height: 16px;
}
.settingspage .tk-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.settingspage .tk-meta b {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.settingspage .tk-meta small {
  font-size: 12px;
  color: var(--faint);
  font-family: var(--font-mono);
}

/* ===== 커넥터 기본 모드 칩 ===== */
.settingspage .set-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.settingspage .set-mode {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--muted);
  padding: 6px 11px;
  border-radius: 999px;
  background: var(--glass-2);
  border: 1px solid var(--line-2);
}
.settingspage .set-mode b {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
}

/* ===== 빈 상태 ===== */
.settingspage .set-empty {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13.5px;
}
.settingspage .set-empty .ic {
  width: 18px;
  height: 18px;
}
.settingspage .set-empty-row {
  font-size: 13px;
  color: var(--muted);
  padding: 4px 2px;
}

/* ===== 토스트 (life.css 와 동일, .settingspage 스코프) ===== */
.settingspage .toast-wrap {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 60;
  pointer-events: none;
}
.settingspage .au-toast {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  padding: 11px 16px;
  border-radius: 13px;
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--glass-brd);
  box-shadow: var(--shadow);
  animation: set-toastin 0.28s ease;
}
.settingspage .au-toast .t-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
@keyframes set-toastin {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ===== 반응형: 레일을 상단으로 ===== */
@media (max-width: 900px) {
  .settingspage .set-work {
    flex-direction: column;
  }
  .settingspage .set-rail {
    position: static;
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
  }
  .settingspage .set-tab {
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 92px;
    text-align: center;
  }
  .settingspage .st-txt small {
    display: none;
  }
}
