/* StreamyOps 전역 스타일.
   모든 값은 docs/design-system.md에 정의된 토큰·사양에서 가져온다. 새 색상/간격/radius/폰트 크기를 만들지 않는다. */

/* ── §7 전역 유틸 ─────────────────────────────────────────── */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--bg-canvas);
  color: var(--text-3);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

::selection { background: rgba(46, 230, 173, .3); }

a { color: var(--violet-100); text-decoration: none; }
a:hover { color: var(--mint-400); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .12); border-radius: var(--r-tag); }
::-webkit-scrollbar-track { background: transparent; }

h1, h2, h3, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }

button { font-family: inherit; cursor: pointer; }

/* §9 포커스 표시는 제거하지 않는다 */
:focus-visible {
  outline: 2px solid var(--violet-500);
  outline-offset: 2px;
}

/* §9 prefers-reduced-motion 존중 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* ── §3.1 셸 ──────────────────────────────────────────────── */
.shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.rail {
  flex: 0 0 auto;
  width: var(--rail-w);
  background: var(--bg-rail);
  border-right: 1px solid rgba(255, 255, 255, .08);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
}

.main {
  flex: 1;
  padding: var(--main-pad);
  overflow-y: auto;
}

/* ── §6.2 브랜드 마크 ─────────────────────────────────────── */
.brand { display: flex; align-items: center; gap: 10px; }

.brand__mark {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  background: var(--grad-brand);
  box-shadow: var(--shadow-logo);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  flex: 0 0 auto;
}

.brand__word {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--text-1);
  letter-spacing: .04em;
  text-transform: uppercase;
}

.brand__sub {
  font-size: 9.5px;
  color: var(--text-4);
  letter-spacing: .14em;
  text-transform: uppercase;
  margin-top: 2px;
}

/* ── §6.1 사이드바 네비 아이템 ────────────────────────────── */
.nav { display: flex; flex-direction: column; gap: 2px; }

.nav__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: var(--r-md);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-3);
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  min-height: 32px;
}

.nav__item:hover { background: rgba(139, 92, 246, .14); }

.nav__item.active {
  background: rgba(139, 92, 246, .18);
  color: var(--text-1);
}

.nav__dot {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  flex: 0 0 auto;
}

.rail__footer { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }

.rail__operator {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11.5px;
  color: var(--text-4);
}

.rail__avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--grad-avatar);
  color: #fff;
  font-weight: 800;
  font-size: 11.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.rail__operator-name { color: var(--text-2); font-size: 12.5px; font-weight: 700; }

/* ── §6.3 컨텍스트 스위처 ─────────────────────────────────── */
.switcher {
  background: var(--surface-1);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: var(--r-md);
  padding: 9px 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-3);
  font-family: inherit;
  width: 100%;
  min-height: 32px;
}

.switcher:focus { border-color: rgba(139, 92, 246, .5); outline: none; }

.switcher__label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-4);
  margin-bottom: 6px;
  display: block;
}

/* ── §6.4 페이지 헤더 ─────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: var(--gap);
}

.page-header h1 { font-size: 22px; font-weight: 800; color: var(--text-1); }
.page-header p { font-size: 13px; color: var(--text-3); margin-top: 5px; line-height: 1.55; }
.page-header__actions { display: flex; gap: 10px; align-items: center; }

.back-link { font-size: 12.5px; font-weight: 600; color: var(--violet-100); display: inline-block; margin-bottom: 10px; }

/* ── §6.5 카드 / 패널 ─────────────────────────────────────── */
.panel {
  background: var(--surface-1);
  border: 1px solid var(--line-card);
  border-radius: var(--r-xl);
  padding: 20px;
}

.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.panel__title { font-size: 14.5px; font-weight: 700; color: var(--text-1); }
.panel__meta { font-size: 11.5px; color: var(--text-4); }

/* ── 그리드 (§3.3) ────────────────────────────────────────── */
.grid-kpi { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap); }
.grid-main-side { display: grid; grid-template-columns: 1.1fr 1fr; gap: var(--gap); margin-top: var(--gap); }
.stack { display: flex; flex-direction: column; gap: var(--gap); }

/* ── §6.6 KPI 카드 ────────────────────────────────────────── */
.kpi {
  background: var(--surface-1);
  border: 1px solid var(--line-card);
  border-radius: var(--r-xl);
  padding: 18px 20px;
}

.kpi__label { font-size: 12.5px; color: var(--text-3); font-weight: 600; }
.kpi__value { font-size: 30px; font-weight: 800; color: var(--text-1); letter-spacing: -.02em; margin-top: 8px; }
.kpi__note { font-size: 12px; color: var(--text-4); margin-top: 7px; line-height: 1.55; }

/* ── §6.7 버튼 4종 ────────────────────────────────────────── */
.btn {
  border: none;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  transition: transform .1s, opacity .1s, background .1s, border-color .1s;
}

.btn--primary {
  background: var(--grad-cta);
  color: var(--text-on-mint);
  font-weight: 800;
  font-size: 13.5px;
  padding: 11px 20px;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-cta);
}

.btn--primary:hover { transform: translateY(-1px); }

.btn--primary:disabled {
  background: rgba(139, 92, 246, .2);
  color: var(--violet-100);
  box-shadow: none;
  transform: none;
  cursor: default;
}

.btn--secondary {
  background: var(--grad-brand);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  padding: 9px 17px;
  border-radius: var(--r-sm);
}

.btn--secondary:hover { opacity: .9; }

.btn--tinted {
  background: rgba(139, 92, 246, .14);
  border: 1px solid rgba(139, 92, 246, .3);
  color: var(--violet-100);
  font-weight: 700;
  font-size: 12.5px;
  padding: 8px 14px;
  border-radius: var(--r-md);
}

.btn--tinted:hover { background: rgba(139, 92, 246, .24); }

.btn--ghost {
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .14);
  color: var(--text-2);
  font-weight: 700;
  font-size: 12.5px;
  padding: 8px 14px;
  border-radius: var(--r-md);
}

.btn--ghost:hover { background: rgba(255, 255, 255, .1); }

/* ── §6.8 인풋 ────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; }
.field + .field { margin-top: var(--gap); }

.field__label { font-size: 12.5px; font-weight: 600; color: var(--text-3); margin-bottom: 8px; }

.input {
  background: var(--surface-2);
  border: 1px solid var(--line-input);
  border-radius: var(--r-md);
  padding: 11px 14px;
  color: var(--text-1);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  outline: none;
}

.input:focus { border-color: rgba(139, 92, 246, .5); }
.input::placeholder { color: var(--text-4); font-weight: 600; }

/* ── §6.10 배지 / 상태 칩 ─────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  white-space: nowrap;
}

.badge--success { background: var(--success-bg); color: var(--success); }
.badge--warning { background: var(--warning-bg); color: var(--warning); }
.badge--danger { background: var(--danger-bg); color: var(--danger); }
.badge--info { background: var(--info-bg); color: var(--info); }
.badge--neutral { background: var(--neutral-bg); color: var(--neutral); }

/* ── §6.11 필터 칩 ────────────────────────────────────────── */
.chip {
  font-size: 12px;
  font-weight: 700;
  padding: 7px 15px;
  border-radius: var(--r-pill);
  border: none;
  background: rgba(255, 255, 255, .05);
  color: var(--text-3);
  font-family: inherit;
  min-height: 32px;
}

.chip:hover { background: rgba(139, 92, 246, .16); }
.chip.active { background: rgba(139, 92, 246, .22); color: var(--text-1); }

.filter-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }

/* ── §6.19 리스트 행 ──────────────────────────────────────── */
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
  border-top: 1px solid var(--line-row);
  font-size: 12.5px;
}

.row:first-child { border-top: none; }
.row--link { border-radius: var(--r-md); }
.row--link:hover { background: var(--row-hover); }

.row__actor { font-weight: 700; color: var(--violet-100); flex: 0 0 auto; min-width: 88px; }
.row__time { color: var(--text-4); flex: 0 0 auto; font-size: 11.5px; }
.row__body { flex: 1; color: var(--text-2); overflow-wrap: anywhere; }
.row__target { color: var(--text-3); }

/* ── §6.17 인포 콜아웃 ────────────────────────────────────── */
.callout {
  background: rgba(139, 92, 246, .07);
  border: 1px solid rgba(139, 92, 246, .2);
  border-radius: var(--r-lg);
  padding: 16px 20px;
  font-size: 12.5px;
  color: var(--text-3);
  line-height: 1.6;
}

/* §6.17 콜아웃 보더 규칙(.2)을 경고색에 적용 */
.callout--warning {
  background: var(--warning-bg);
  border-color: rgba(240, 192, 74, .2);
}

/* ── 상태 3종 (빈 / 로딩 / 에러) ──────────────────────────── */
.state {
  padding: 26px 20px;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-3);
  line-height: 1.6;
}

.state__title { font-size: 14px; font-weight: 700; color: var(--text-2); margin-bottom: 5px; }
.state__hint { color: var(--text-4); font-size: 11.5px; }
.state__actions { margin-top: 14px; display: flex; justify-content: center; gap: 10px; }

.state--error .state__title { color: var(--danger); }

.skeleton {
  background: rgba(255, 255, 255, .07);
  border-radius: var(--r-tag);
  height: 12px;
}

.skeleton + .skeleton { margin-top: 10px; }
.skeleton--value { height: 26px; width: 60%; }

/* ── 로그인 화면 (§3.3 폼 컨테이너) ───────────────────────── */
.login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 26px;
}

.login__card {
  width: 100%;
  max-width: 380px;
  background: var(--surface-1);
  border: 1px solid var(--line-card);
  border-radius: var(--r-xl);
  padding: 26px;
}

.login__title { font-size: 22px; font-weight: 800; color: var(--text-1); margin-top: 18px; }
.login__desc { font-size: 13px; color: var(--text-3); margin-top: 5px; line-height: 1.55; }
.login__submit { width: 100%; margin-top: 20px; }

/* 실패 표시 보더는 §6.22 실패 토스트와 같은 값을 쓴다 */
.form-error {
  background: var(--danger-bg);
  border: 1px solid rgba(240, 100, 120, .4);
  border-radius: var(--r-lg);
  padding: 12px 14px;
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.6;
  margin-top: var(--gap);
}

.form-error b { color: var(--danger); }

/* ── 감사 로그 화면 ───────────────────────────────────────── */
.audit-list { display: flex; flex-direction: column; }
.audit-more { display: flex; justify-content: center; margin-top: var(--gap); }

/* ── §9 반응형: 1024px 이하 아이콘 레일 ───────────────────── */
@media (max-width: 1024px) {
  .rail { width: 64px; padding: 18px 10px; }
  .brand__text, .nav__item-label, .switcher__label, .rail__operator-text { display: none; }
  .nav__item { justify-content: center; padding: 9px; }
  .grid-kpi { grid-template-columns: repeat(2, 1fr); }
  .grid-main-side { grid-template-columns: 1fr; }
  .main { padding: 20px 18px 60px; }
}

/* ── 온보딩 (002) ─────────────────────────────────────────── */

/* §6.14 파이프라인 스테퍼 */
.stepper {
  display: flex;
  gap: 10px;
  background: var(--surface-1);
  border: 1px solid var(--line-card);
  border-radius: var(--r-xl);
  padding: 14px 16px;
}

.stepper__item {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-3);
  min-height: 32px;
}

.stepper__item:hover { background: rgba(139, 92, 246, .14); }

.stepper__item.active {
  background: rgba(139, 92, 246, .18);
  border-color: var(--line-hover);
  color: var(--text-1);
}

.stepper__dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  flex: 0 0 auto;
}

.stepper__dot--done { background: var(--grad-cta); color: var(--text-on-mint); }
.stepper__dot--inprogress { background: var(--violet-500); border: 2px solid var(--violet-100); }
.stepper__dot--waiting { background: var(--surface-2); border: 2px solid rgba(255, 255, 255, .14); }

.stepper__label { flex: 1; text-align: left; }

/* 테마 단계: 목록 · 편집 · 미리보기 3열 */
.theme-step {
  display: grid;
  grid-template-columns: 300px 1fr 380px;
  gap: var(--gap);
  align-items: start;
}

/* 확인 단계 */
.confirm {
  background: var(--surface-2);
  border: 1px solid rgba(139, 92, 246, .3);
  border-radius: var(--r-lg);
  padding: 16px 18px;
}

.confirm__title { font-size: 14px; font-weight: 800; color: var(--text-1); }
.confirm__target { font-size: 12.5px; color: var(--text-3); margin-top: 4px; }

.confirm__changes { margin-top: var(--gap); display: flex; flex-direction: column; gap: 8px; }

.confirm__change {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  flex-wrap: wrap;
}

.confirm__field { color: var(--text-3); min-width: 96px; font-weight: 700; }
.confirm__before { color: var(--text-4); overflow-wrap: anywhere; }
.confirm__arrow { color: var(--violet-100); }
.confirm__after { color: var(--text-1); font-weight: 700; overflow-wrap: anywhere; }

.confirm__rows { margin-top: var(--gap); font-size: 12.5px; color: var(--text-3); }
.confirm__rows b { color: var(--text-1); }

.confirm__blockers {
  margin-top: var(--gap);
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
  color: var(--danger);
}

.confirm__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: var(--gap);
}

.confirm__note { margin-top: 10px; font-size: 11.5px; color: var(--text-4); }

/* 저장 결과 */
.write-result {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: var(--r-lg);
  padding: 12px 14px;
  font-size: 12.5px;
}

.write-result--ok { background: var(--success-bg); border: 1px solid rgba(46, 230, 173, .3); }
.write-result--fail { background: var(--danger-bg); border: 1px solid rgba(240, 100, 120, .4); }

.write-result__message { color: var(--text-2); flex: 1; }
.write-result__rows { color: var(--text-4); font-size: 11.5px; }

/* 목록 안의 링크형 버튼 */
.linklike {
  background: none;
  border: none;
  color: var(--text-2);
  font-family: inherit;
  font-size: 12.5px;
  text-align: left;
  padding: 0;
}

.linklike:hover { color: var(--violet-100); }

.row--active { background: rgba(139, 92, 246, .14); border-radius: var(--r-md); }

.btn--tiny { padding: 5px 10px; font-size: 11.5px; min-height: 28px; }

@media (max-width: 1400px) {
  .theme-step { grid-template-columns: 260px 1fr; }
  .theme-step__preview { grid-column: 1 / -1; }
}

@media (max-width: 1024px) {
  .stepper { flex-wrap: wrap; }
  .stepper__item { flex: 1 1 45%; }
  .theme-step { grid-template-columns: 1fr; }
}
