/*
 * collaba Design System
 * Surface elevation + typography hierarchy (Tailwind v4 native)
 */

/* Pretendard Variable (본문) + Shrikhand (logo) */
@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable.min.css");
@import url("https://fonts.googleapis.com/css2?family=Shrikhand&display=swap");

/* ── Design Tokens ── */
:root {
  /* Surface System (elevation by background) */
  --surface-0: #ffffff;
  --surface-1: #f2f2f2;          /* 본문 bg — 카드(surface-0)와 대비 확보 */
  --surface-2: #e6e6e6;          /* hover / 분리선 톤 */
  --surface-3: #e4e4e7;
  --surface-hover: #f4f4f5;
  --surface-active: #ebebed;
  --border-subtle: #ececef;      /* 내부 구분선 (테이블 행·footer 등) */
  --border-default: #e2e2e6;     /* 카드·영역 외곽선 — 흰 바탕에서 border로 영역 구분 */
  --border-strong: #c7c7cc;      /* hover·active 강조 테두리 — border-default보다 진한 중립 */

  /* Text Hierarchy */
  --text-primary: #18181b;
  --text-secondary: #52525b;
  /* 기능 텍스트(캡션·힌트·라벨·타임스탬프·placeholder 등)용 — 흰 배경 4.5:1 충족(zinc-500, WCAG AA). */
  --text-muted: #71717a;
  /* 순수 장식(아이콘·구분점·disabled·border)용 — 콘텐츠 텍스트엔 쓰지 말 것(대비 미달). */
  --text-tertiary: #a1a1aa;
  --text-inverse: #ffffff;

  /* Semantic Colors */
  --primary: #222222;
  --brand-accent: #DD0036;
  --destructive: #ef4444;
  --presence-online: #22c55e;

  /* Primary variants */
  --primary-hover: #111111;

  /* CTA (brand-accent for primary action buttons) */
  --cta: #DD0036;
  --cta-hover: #B80030;

  /* Radius Scale */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  /* Destructive palette */
  --destructive-light: #fef2f2;
  --destructive-dark: #dc2626;
  --destructive-border: #fecaca;

  /* Status palette (success/warning/info) — danger는 destructive palette 재사용 */
  --status-success: #22c55e;
  --status-success-light: #dcfce7;
  --status-success-dark: #166534;
  --status-success-border: #bbf7d0;
  --status-warning: #f59e0b;
  --status-warning-light: #fef3c7;
  --status-warning-dark: #92400e;
  --status-warning-border: #fde68a;
  --status-info: #3b82f6;
  --status-info-light: #dbeafe;
  --status-info-dark: #1e40af;
  --status-info-border: #bfdbfe;

  /* Accent palette — 브랜드 액센트 (액센트 컬러 단일 출처). 결정: docs/spec/badge-button-palette-refinement.md */
  --accent-sky: #1181f5;
  --accent-pink: #dd5bab;
  --accent-green: #01b55a;
  --accent-yellow: #ffd822;
  --accent-orange: #fc8a1d;
  --accent-red: #ff0008;
  --accent-blue: #006def;
  --accent-gray: #8b8b8b;

  /* Badge/Banner — 액센트 의미색 매핑. 글자색은 .badge-* 규칙에서 루마 기준(흰/잉크) */
  --badge-info: var(--accent-blue);
  --badge-success: var(--accent-green);
  --badge-warning: var(--accent-orange);
  --badge-danger: var(--accent-red);
  --badge-purple: var(--accent-pink);
  --badge-yellow: var(--accent-yellow);
  --badge-ink: #1c1c1f;
  /* Badge light 톤 — info/success/warning/danger는 status·destructive 토큰 재사용.
     purple/yellow는 status 토큰이 없어 파스텔 쌍을 정의(badge 전용). */
  --badge-purple-light: #fbe9f4;
  --badge-purple-dark: #9d3384;
  --badge-yellow-light: #fef7cd;
  --badge-yellow-dark: #854d0e;
  --banner-info-bg: #e0edfd;
  --banner-info-text: #003678;
  --banner-success-bg: #e1f6eb;
  --banner-success-text: #005a2d;
  --banner-warning-bg: #fff1e4;
  --banner-warning-text: #7e450e;
  --banner-danger-bg: #ffe0e1;
  --banner-danger-text: #800004;

  /* Scrollbar */
  --scrollbar-thumb: #d4d4d8;
  --scrollbar-thumb-hover: #a1a1aa;

  /* Shadows */
  --shadow-focus-ring: 0 0 0 3px rgba(34, 34, 34, 0.1);
  --shadow-cta-ring: 0 0 0 3px rgba(221, 0, 54, 0.2);
  --shadow-btn: 0 1px 2px rgba(221, 0, 54, 0.3);
  --shadow-btn-hover: 0 4px 12px rgba(221, 0, 54, 0.35);
  --shadow-subtle: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-elevated: 0 8px 32px rgba(0, 0, 0, 0.06);
  --shadow-overlay: 0 16px 48px rgba(0, 0, 0, 0.08);
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-dropdown: 0 8px 32px rgba(0, 0, 0, 0.06);

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Typography — BrandKit이 :root에서 override 가능 */
  --font-body: "Pretendard Variable", Pretendard, -apple-system, system-ui, "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  --font-display: var(--font-body);
}

/* ── Global Styles ── */
body {
  font-family: var(--font-body);
  background-color: var(--surface-0);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Cards (흰 바탕에서 border로 영역 구분, 그림자 없음) ── */
.card {
  border-radius: var(--radius-lg);
  background-color: var(--surface-0);
  border: 1px solid var(--border-default);
}

.card-header {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  padding: 1.5rem 1.5rem 0;
}

.card-content {
  padding: 1.5rem;
}

.card-footer {
  display: flex;
  align-items: center;
  padding: 0 1.5rem 1.5rem;
}

/* Card content 안의 첫 section-title은 카드 sub-header로 처리 — 본문과 시각 분리.
 * border-bottom + bottom padding. 카드 padding(1.5rem)을 고려해 negative margin으로 가로 꽉 채움. */
.card-content > .section-title:first-child {
  margin: -0.5rem -1.5rem 1.25rem;
  padding: 0 1.5rem 0.875rem;
  border-bottom: 1px solid var(--border-subtle);
}

/* card-header-row는 자체 border-b-subtle을 가지므로, 그 안의 첫 section-title엔
 * sub-header 보더/음수마진을 적용하지 않는다 — flex로 h3가 줄어 생기는 짧은 줄 중복 방지. */
.card-content.card-header-row > .section-title:first-child {
  margin: 0;
  padding: 0;
  border-bottom: none;
}

/* Card footer 영역 (metadata 등 부가 정보) — 옅은 background + border-top */
.card-meta-footer {
  margin: 1.25rem -1.5rem -1.5rem;
  padding: 0.75rem 1.5rem;
  border-top: 1px solid var(--border-subtle);
  background-color: var(--surface-1);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  font-size: 0.8125rem;
  color: var(--text-muted);
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.card-interactive {
  border-radius: var(--radius-lg);
  background-color: var(--surface-0);
  border: 1px solid var(--border-default);
  transition: background-color var(--transition-base), border-color var(--transition-base);
}

.card-interactive:hover {
  background-color: var(--surface-hover);
  border-color: var(--surface-2);
}

.card-interactive.block {
  padding: 0.75rem 1rem;
}

/* ── Buttons — Apple vibe (flat, rounded, semibold) ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  white-space: nowrap;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  border-radius: 10px;
  padding: 0.5rem 1rem;
  transition: all var(--transition-fast);
}

.btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.btn:disabled {
  pointer-events: none;
  opacity: 0.5;
}

/* 제출 진행 중(submit_lock) — 클릭 차단 + 진행 표시. input[type=submit]엔 스피너를 못 넣어 상태만. */
.is-busy {
  pointer-events: none;
  opacity: 0.65;
  cursor: wait;
}

.btn-primary {
  background-color: var(--cta);
  color: var(--text-inverse);
}

.btn-primary:hover {
  background-color: var(--cta-hover);
}

/* 확인(긍정) 액션 — 배지 success와 동일 그린 + 흰 글자 */
.btn-success {
  background-color: var(--accent-green);
  color: #fff;
}

.btn-success:hover {
  background-color: #019a4d;
}

/* 조건부 승인 — 승인(녹)·수정요청(주황)과 구분되는 보라 톤(배지 색과 일관). */
.btn-conditional {
  background-color: var(--badge-purple);
  color: #fff;
}

.btn-conditional:hover {
  filter: brightness(0.94);
}

/* 단계 이동(전진) — 상태 배지 info(파랑)와 동일. 승인(그린)·신청(CTA 레드)과 색으로 구분(#666). */
.btn-info {
  background-color: var(--badge-info);
  color: #fff;
}

.btn-info:hover {
  filter: brightness(0.94);
}

/* 수정요청 — 배지 warning(앰버)과 동일 */
.btn-warning {
  background-color: var(--badge-warning);
  color: var(--badge-ink);
}

.btn-warning:hover {
  filter: brightness(0.94);
}

/* 반려 — 배지 danger(레드)와 동일, 바탕 채움(투명 토글 대체) */
.btn-destructive-solid {
  background-color: var(--badge-danger);
  color: #fff;
}

.btn-destructive-solid:hover {
  filter: brightness(0.94);
}

/* 중립(secondary) 버튼 — 회색 채움이 disabled로 오인되지 않도록 진한 글자(text-primary)로 대비 확보.
   disabled는 opacity 0.5로 확실히 구분되므로, 활성은 또렷한 글자색으로 "클릭 가능"임을 명시. */
.btn-secondary {
  background-color: var(--surface-2);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background-color: var(--surface-3);
}

.btn-destructive {
  background-color: var(--destructive-light);
  color: var(--destructive-dark);
  border-color: var(--destructive-border);
}

.btn-destructive:hover {
  background-color: var(--destructive-border);
}

.btn-outline {
  background-color: transparent;
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

.btn-outline:hover {
  background-color: var(--surface-hover);
}

/* 고스트 버튼 — 투명 배경이라 글자가 유일한 단서. text-muted는 비활성처럼 읽혀 text-secondary로 상향. */
.btn-ghost {
  background-color: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background-color: var(--surface-hover);
  color: var(--text-primary);
}

.btn-link {
  display: inline-flex;
  align-items: center;
  gap: 0.125rem;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 0;
  font: inherit;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.btn-link:hover {
  color: var(--primary-hover);
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
}

.btn-lg {
  padding: 0.625rem 1.5rem;
  font-size: 0.9375rem;
}

.btn-icon {
  padding: 0.5rem;
  /* 터치 타깃 44px(WCAG 2.5.5) — 아이콘 버튼 최소 크기 보장 */
  min-width: 2.75rem;
  min-height: 2.75rem;
}

@media (max-width: 1023px) {
  .btn {
    min-height: 2.75rem;
  }
}

/* Full-width variant for auth forms */
.btn-block {
  width: 100%;
  text-align: center;
  box-sizing: border-box;
}

/* ── Inputs ── */
.input {
  display: flex;
  width: 100%;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--text-primary);
  background-color: var(--surface-0);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-sizing: border-box;
  transition: all var(--transition-fast);
}

.input::placeholder {
  color: var(--text-muted);
}

.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--shadow-focus-ring);
}

.input:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.375rem;
}

.select {
  display: flex;
  width: auto;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--text-primary);
  background-color: var(--surface-0);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-sizing: border-box;
  transition: all var(--transition-fast);
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23a1a1aa' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.5rem center;
  background-repeat: no-repeat;
  background-size: 1.25rem;
  padding-right: 2.25rem;
}

.select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--shadow-focus-ring);
}

.textarea {
  display: flex;
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--text-primary);
  background-color: var(--surface-0);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-sizing: border-box;
  transition: all var(--transition-fast);
  min-height: 5rem;
  resize: vertical;
}

.textarea::placeholder {
  color: var(--text-muted);
}

.textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--shadow-focus-ring);
}

/* ── Badge — Apple System Colors (vivid solid). 결정: docs/spec/badge-button-palette-refinement.md ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.25rem;
  white-space: nowrap;
}

/* 중립 배지 — 회색 채움+회색 글자는 비활성 칩처럼 읽힘. 옅은 배경 + 또렷한 테두리로 "의도된 라벨"임을
   정의하고 글자 대비를 유지(disabled 오인 방지). 색 배지들과 달리 테두리로 형태를 잡는다. */
.badge-soft {
  background-color: var(--surface-1);
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
}

.badge-strong {
  background-color: var(--primary);
  color: var(--text-inverse);
}

.badge-info {
  background-color: var(--badge-info);
  color: #fff;
}

.badge-success {
  background-color: var(--badge-success);
  color: #fff;
}

.badge-warning {
  background-color: var(--badge-warning);
  color: var(--badge-ink);
}

.badge-danger {
  background-color: var(--badge-danger);
  color: #fff;
}

.badge-purple {
  background-color: var(--badge-purple);
  color: #fff;
}

.badge-yellow {
  background-color: var(--badge-yellow);
  color: var(--badge-ink);
}

.badge-outline {
  background-color: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

/* Light 톤 — 파스텔 배경 + 진한 글자. solid(위)와 같은 의미색의 저채도 버전. tone: :light로 선택. */
.badge-info-light { background-color: var(--status-info-light); color: var(--status-info-dark); }
.badge-success-light { background-color: var(--status-success-light); color: var(--status-success-dark); }
.badge-warning-light { background-color: var(--status-warning-light); color: var(--status-warning-dark); }
.badge-danger-light { background-color: var(--destructive-light); color: var(--destructive-dark); }
.badge-purple-light { background-color: var(--badge-purple-light); color: var(--badge-purple-dark); }
.badge-yellow-light { background-color: var(--badge-yellow-light); color: var(--badge-yellow-dark); }

/* ── Banner ── */
.banner {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.banner-info {
  background-color: var(--banner-info-bg);
  color: var(--banner-info-text);
}

.banner-success {
  background-color: var(--banner-success-bg);
  color: var(--banner-success-text);
}

.banner-warning {
  background-color: var(--banner-warning-bg);
  color: var(--banner-warning-text);
}

.banner-danger {
  background-color: var(--banner-danger-bg);
  color: var(--banner-danger-text);
}

/* 조건부 승인 안내 — 배지·버튼 보라 톤과 일관. */
.banner-purple {
  background-color: color-mix(in srgb, var(--badge-purple) 14%, #fff);
  color: color-mix(in srgb, var(--badge-purple) 72%, #000);
}

/* ── Typography Hierarchy ── */
.page-title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.4px;
  line-height: 1.3;
  color: var(--text-primary);
  overflow-wrap: break-word;
  word-break: break-word;
}
@media (min-width: 640px) {
  .page-title {
    font-size: 2rem;
    letter-spacing: -0.5px;
  }
}

.section-title {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.15px;
  margin-bottom: 1rem;
}

/* 규칙: 섹션 제목 바로 뒤에 따라오는 설명문(부제)은 제목과 밀착시키고 본문과 한 칸 띄움.
 * 제목의 margin-bottom(1rem)을 음수 margin으로 당겨 net 0.25rem 간격을 만든다.
 * 호출부는 제목+부제만 연달아 쓰면 되고 래퍼·클래스 추가 불필요. */
.section-title + .body-text,
.section-title-lg + .body-text,
.section-title-xl + .body-text {
  margin-top: -0.75rem;
  margin-bottom: 1rem;
}

/* 예외: 카드 sub-header(border-bottom 보유) 뒤 본문은 헤더 패딩을 존중 — 당기지 않음 */
.card-content > .section-title:first-child + .body-text {
  margin-top: 0;
}

.section-title-lg {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.2px;
  margin-bottom: 1rem;
}

.section-title-xl {
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.3px;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

/* Ui::SectionHeader — 섹션 제목 + (선택)우측 액션 행. section-head-row의 통일 컴포넌트 대체. */
.ui-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem; /* 헤더↔콘텐츠 간격 — 구 .dashboard-section-header에서 이관 */
}

.ui-section-header .section-title {
  margin-bottom: 0;
}

/* 제목 + 카운트 핀 좌측 그룹 */
.ui-section-header-title {
  display: inline-flex;
  align-items: center;
}

/* 제목 옆 개수 핀(예: "내 할일 3") — 구 .dash-section-count 시각 유지 */
.ui-section-header-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.4rem;
  height: 1.4rem;
  padding: 0 0.45rem;
  margin-left: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  background-color: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
}

.body-text {
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.label-text {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.caption-text {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.page-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* ── Logo ── */
.logo-text {
  font-family: 'Shrikhand', cursive;
  font-size: 22px;
  letter-spacing: -0.5px;
}

.logo-primary {
  color: #111111;
}

.service-logo-primary {
  color: #111111;
}

.logo-accent {
  color: var(--brand-accent);
}

/* ── Form Feedback ── */
.form-error {
  font-size: 0.875rem;
  color: var(--destructive);
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* ── Error Box ── */
.error-box {
  background-color: var(--destructive-light);
  border: 1px solid var(--destructive-border);
  border-radius: 0.5rem;
  padding: 1rem;
}

.error-box-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--destructive-dark);
  margin-bottom: 0.5rem;
}

.error-box-list {
  list-style-type: disc;
  list-style-position: inside;
  font-size: 0.875rem;
  color: var(--destructive);
}

/* ── Page Layout ── */
.page-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.5rem;
  max-width: 80rem;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}
@media (min-width: 1024px) {
  .page-container {
    padding: 2.5rem 3.5rem;
  }
}

.page-header {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 2rem;
}
@media (min-width: 640px) {
  .page-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
  }
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.empty-state-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 4rem;
  height: 4rem;
  border-radius: var(--radius-full);
  background-color: var(--surface-2);
  color: var(--text-tertiary);
}

.empty-state-icon svg {
  height: 1.5rem;
  width: 1.5rem;
}

.empty-state-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.empty-state-desc {
  color: var(--text-secondary);
}

/* ── Detail Page ── */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.detail-grid > * {
  min-width: 0;
}
@media (min-width: 1024px) {
  .detail-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* ── DetailList ──
 * label-value 표시. 80rem 카드 안에서 line-length를 통제하기 위해 max-width 적용.
 * label column = clamp(8rem, 25%, 14rem) 고정, value = 1fr (좌측 정렬).
 * justify-between으로 양 끝에 붙는 패턴 금지 — 폭이 넓을수록 label-value 거리 비대해짐.
 */
.detail-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 48rem;
}

/* 항목이 많은 detail (회사 상세 등) — 2+ column으로 자동 분산. max-width 해제. */
.detail-list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr));
  gap: 0.75rem 2rem;
  max-width: none;
}

.detail-row {
  display: grid;
  grid-template-columns: clamp(8rem, 25%, 14rem) 1fr;
  gap: 1.5rem;
  align-items: baseline;
}

.detail-term {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.detail-value {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  text-align: left;
  word-break: break-word;
}

.detail-value-empty {
  color: var(--text-muted);
  font-weight: 400;
}

@media (max-width: 480px) {
  .detail-row {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }
}

/* ── Link Utilities ── */
.back-link {
  display: inline-flex;
  align-items: center;
  font-size: 0.875rem;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

.back-link:hover {
  color: var(--text-primary);
}

.text-link {
  color: var(--text-primary);
  transition: color var(--transition-fast);
}

.text-link:hover {
  text-decoration: underline;
}

.detail-link {
  color: var(--text-primary);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.detail-link:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.detail-link:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ── Text Utilities ── */
.text-pre-wrap {
  white-space: pre-wrap;
}

/* ── Border Utilities ── */
.border-b-subtle {
  border-bottom: 1px solid var(--border-subtle);
}

.border-t-subtle {
  border-top: 1px solid var(--border-subtle);
}

/* ── Table ── */
.table {
  width: 100%;
  caption-side: bottom;
  font-size: 0.875rem;
  border-collapse: collapse;
}

/* 헤더 행 — 옅은 톤 + 강한 하단선으로 표 구조를 또렷하게(프로 데이터테이블). */
.table-header {
  background-color: var(--surface-1);
  border-bottom: 1px solid var(--border-default);
}

.table-header th {
  padding: 0.625rem 1rem;
  text-align: left;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  white-space: nowrap;
}

.table-row {
  border-bottom: 1px solid var(--border-subtle);
  transition: background-color var(--transition-fast);
}

.table-row:last-child {
  border-bottom: none;
}

.table-row:hover {
  background-color: var(--surface-hover);
}

.table-cell {
  padding: 0.8125rem 1rem;
  vertical-align: middle;
  color: var(--text-secondary);
}

/* 첫 열 = 주 식별자(이름·제목) — 본문 강조색·중간 굵기로 시선 앵커. */
.table-row .table-cell:first-child {
  color: var(--text-primary);
  font-weight: 500;
}

/* table-linkable: 테이블형 리스트는 별도 상세 화살표 없이 행 전체가 상세 이동 영역이다. */
.table-linkable tr.table-row {
  position: relative;
  cursor: pointer;
}

.table-linkable .card-stretch-link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

.table-linkable td.table-cell a:not(.card-stretch-link),
.table-linkable td.table-cell button,
.table-linkable td.table-cell .btn {
  position: relative;
  z-index: 2;
}

/* 목록 첫 열의 compact identity — 상세용 파일 카드 정보는 배제하고 식별에 필요한 썸네일·제목·코드만 표시. */
.table-identity {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 12rem;
}

.table-identity-thumbnail {
  display: flex;
  flex: 0 0 3rem;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface-1);
  color: var(--text-muted);
}

.table-identity-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.table-identity-copy {
  display: flex;
  flex-direction: column;
  gap: 0.1875rem;
  min-width: 0;
}

.table-identity-title {
  overflow: hidden;
  color: var(--text-primary);
  font-weight: 600;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-identity-meta {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 400;
}

/* 규칙: Ui::Table(responsive)은 가용 폭이 좁으면 각 행을 카드로 자동 reflow.
 * 호출부는 테이블만 작성하면 되고 별도 mobile-card-list가 필요 없다.
 * 뷰포트가 아니라 테이블 컨테이너를 기준으로 행=카드·셀=세로 스택. */
.table-responsive-container {
  container-type: inline-size;
}
@container (max-width: 62rem) {
  .table-responsive.card {
    border: none;
    box-shadow: none;
    background-color: transparent;
    overflow: visible;
  }
  .table-responsive .overflow-x-auto {
    overflow: visible;
  }
  .table-responsive table,
  .table-responsive tbody,
  .table-responsive tr,
  .table-responsive td {
    display: block;
    width: 100%;
  }
  .table-responsive thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }
  .table-responsive tr.table-row {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background-color: var(--surface-0);
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
  }
  .table-responsive tr.table-row:last-child {
    margin-bottom: 0;
  }
  .table-responsive tr.table-row:hover {
    background-color: var(--surface-0);
  }
  /* 셀은 세로 스택 — 우측정렬 액션 셀도 카드 안에선 좌측 정렬 */
  .table-responsive td.table-cell {
    padding: 0.1875rem 0;
    text-align: left;
    color: var(--text-primary);
  }
  .table-responsive td.table-cell:empty {
    display: none;
  }
  /* 첫 셀(라벨 없는 식별 셀=제목): 카드 제목으로 강조 — 메타 값보다 위계 우위 */
  .table-responsive.table-linkable td.table-cell:first-child:not([data-label]) {
    margin-bottom: 0.375rem;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.35;
  }
  .table-responsive.table-linkable td.table-cell:first-child:not([data-label]) a {
    color: var(--text-primary);
    font-weight: inherit;
  }
  /* data-label 셀: [라벨 고정폭 | 값] 2열 그리드 — 값을 라벨 바로 옆에 좌측정렬해
     정렬된 키-값 블록으로. (우측 끝으로 밀려 셰브론과 충돌하던 space-between 제거.)
     빈 값 셀은 :empty로 숨김(라벨만 뜨지 않도록 :not(:empty)). */
  .table-responsive td.table-cell[data-label]:not(:empty) {
    display: grid;
    grid-template-columns: 5.5rem 1fr;   /* 라벨 컬럼은 가장 긴 한글 라벨(예: 사업자등록번호)에 맞춤 */
    align-items: center;
    justify-items: start;      /* 값은 내용 폭으로 — 배지가 컬럼 전체로 늘어나지 않게 */
    gap: 0.125rem 0.625rem;
  }
  .table-responsive td.table-cell[data-label]:not(:empty)::before {
    content: attr(data-label);
    white-space: nowrap;       /* 라벨은 한 줄 유지(긴 라벨이 2줄로 깨지지 않게) */
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
  }
}

/* ── Avatar ── */
img.avatar {
  object-fit: cover;
  border-radius: var(--radius-full);
}

img.avatar-square {
  object-fit: cover;
  border-radius: var(--radius-md);
}

.avatar-lg, img.avatar-lg { width: 3rem; height: 3rem; }

.avatar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-weight: 600;
  line-height: 1;
  color: var(--text-inverse);
}

/* 이미지 아바타 — 이니셜 폴백 위에 오버레이, 로드 완료 시 페이드인.
   로딩·실패 중엔 opacity:0이라 폴백(이니셜)이 보이고 깨진 이미지 아이콘은 노출되지 않음 */
.avatar-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.avatar-img.is-loaded {
  opacity: 1;
}

.avatar-square {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

/* ── Separator ── */
.separator {
  border: none;
  border-top: 1px solid var(--border-subtle);
}

/* ── Skeleton ── */
.skeleton {
  border-radius: var(--radius-md);
  background-color: var(--surface-2);
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ── Locale Chip ── */
.locale-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  color: var(--text-primary);
}

.locale-chip:hover {
  background-color: var(--surface-hover);
}

.locale-chip-active {
  background-color: var(--primary);
  color: var(--text-inverse);
}

/* ── View Transitions ── */
@view-transition { navigation: auto; }

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 200ms;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Tab Navigation ── */
.tab-nav {
  display: flex;
  white-space: nowrap;
  overflow-x: auto;
  border-bottom: 1px solid var(--border-subtle);
}

.tab-item {
  padding: 0.75rem 1rem;
  min-height: 2.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
  background: none;
  border: none;
  cursor: pointer;
}

.tab-item:hover {
  color: var(--text-primary);
}

.tab-item-active {
  color: var(--text-primary);
  border-bottom: 2px solid var(--primary);
}

/* ── Stat Card ── */
.stat-card {
  border-radius: var(--radius-lg);
  background-color: var(--surface-0);
  border: 1px solid var(--border-default);
  padding: 1.5rem;
}

.stat-card-label {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.stat-card-value {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* ── Filter / Search ── */
.search-input-wrapper {
  position: relative;
}

.search-input-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
}

.search-input {
  padding-left: 2.5rem;
}

.filter-clear {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

.filter-clear:hover {
  color: var(--text-primary);
}

/* ── Filter bar — "필터" 버튼이 다중 차원 패널(popover)을 열고, 적용은 칩으로 노출 ── */
.filter-bar-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.filter-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.filter-search {
  flex: 0 0 auto;
}

/* 검색은 전체폭이 아니라 컴팩트 */
.filter-search-wrapper {
  width: 280px;
  max-width: 100%;
}

.filter-panel-anchor {
  position: relative;
}

/* 트리거 안 적용 개수 배지 */
.filter-trigger-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.125rem;
  height: 1.125rem;
  padding: 0 0.3125rem;
  margin-left: 0.125rem;
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1;
  color: var(--text-inverse);
  background-color: var(--primary);
  border-radius: var(--radius-full);
}

/* 패널(popover) — 트리거 아래 앵커, 다차원 체크박스 + 적용.
   기본은 display:none (언레이어 CSS라 Tailwind .hidden 유틸리티에 의존하지 않음 —
   유틸리티 레이어보다 캐스케이드 우선순위가 높아 .hidden이 무력화됐던 버그 회피).
   .is-open일 때만 노출하며 Stimulus가 클래스를 토글한다. */
.filter-panel {
  position: absolute;
  top: calc(100% + 0.375rem);
  left: 0;
  z-index: 50;
  width: 280px;
  max-width: calc(100vw - 3rem);
  display: none;
  flex-direction: column;
  background-color: var(--surface-0);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.filter-panel.is-open {
  display: flex;
}

.filter-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 0.875rem;
  border-bottom: 1px solid var(--border-subtle);
}

.filter-panel-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.filter-panel-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.filter-panel-close:hover {
  background-color: var(--surface-hover);
  color: var(--text-primary);
}

.filter-panel-body {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  padding: 0.875rem;
  max-height: min(32rem, calc(100vh - 9rem));
  overflow-y: auto;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}

.filter-group-label {
  padding: 0 0 0.25rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.5rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.filter-option:hover {
  background-color: var(--surface-hover);
}

.filter-option-input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

.filter-option-input:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.filter-option-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 등록일 등 날짜 범위 차원 — from/to date input 한 줄(#443) */
.filter-date-range {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.125rem 0.5rem 0.25rem;
}
.filter-date-input {
  flex: 1;
  min-width: 0;
  font-size: 0.8125rem;
}
.filter-date-sep {
  color: var(--text-muted);
  flex-shrink: 0;
}

.filter-panel-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 0.625rem 0.875rem;
  border-top: 1px solid var(--border-subtle);
  background-color: var(--surface-0);
}

.filter-clear-link {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-right: auto;
  transition: color var(--transition-fast);
}

.filter-clear-link:hover {
  color: var(--text-primary);
}

/* 모바일 — 패널을 전체폭 + 터치 타깃 확대 */
@media (max-width: 640px) {
  .filter-panel {
    width: calc(100vw - 3rem);
  }

  .filter-option {
    padding: 0.625rem 0.5rem;
    min-height: 2.75rem;
  }

  .filter-panel-close {
    width: 2.75rem;
    height: 2.75rem;
  }
}

/* 적용된 필터 칩 줄 — 필터 버튼·초기화 아래 별도 행 */
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem;
}

/* 적용된 필터 칩 — 버튼보다 작은 슬림 pill */
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.1875rem;
  padding: 0.0625rem 0.1875rem 0.0625rem 0.4375rem;
  background-color: var(--surface-2);
  border-radius: var(--radius-full);
  white-space: nowrap;
  line-height: 1.3;
}

/* 라벨(차원)은 값보다 작게 — 라벨/값 시각 구분 */
.filter-chip-dim {
  font-size: 0.625rem;
  color: var(--text-muted);
}

.filter-chip-val {
  font-size: 0.6875rem;
  color: var(--text-primary);
  font-weight: 500;
}

.filter-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.875rem;
  height: 0.875rem;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.filter-chip-remove:hover {
  background-color: var(--surface-3);
  color: var(--text-primary);
}

.filter-chip-remove:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

/* 모바일 — 칩 제거 버튼 터치 타깃 확대(시각 크기 유지, 패딩으로 영역만) */
@media (max-width: 640px) {
  .filter-chip {
    padding-top: 0.375rem;
    padding-bottom: 0.375rem;
  }

  .filter-chip-remove {
    width: 1.75rem;
    height: 1.75rem;
  }
}

.result-count {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

/* ── Form Layout ── */
.form-container {
  max-width: 42rem;
  margin-left: auto;
  margin-right: auto;
  padding: 1rem 1rem 2rem;
}
@media (min-width: 640px) {
  .form-container {
    padding: 2rem 1rem;
  }
}

.form-header {
  margin-bottom: 2rem;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 640px) {
  .form-grid-2 {
    grid-template-columns: 1fr 1fr;
  }
}

/* 페이지 폼 액션 — 주 액션 하나를 우측 정렬. 취소는 헤더 back_href가 대신함. */
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
}

/* ── Stat Grid ── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
@media (min-width: 640px) {
  .stat-grid {
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  }
}

/* ── List Items (card-based) ── */
.list-divider {
  border-bottom: 1px solid var(--border-subtle);
}

.list-divider:last-child {
  border-bottom: none;
}

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
}

.list-item-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

/* 텍스트 컬럼 — 제목+배지는 한 줄, subtitle은 아래 줄 */
.list-item-text {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
}

.list-item-titleline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* 행 우측 액션 묶음 — 여러 버튼(form)을 한 덩어리로 우측 정렬 */
.list-item-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

/* 카드 헤더 한 줄 — 제목 + (선택)우측 액션. section-title 기본 margin 제거로 빈 띠 방지 */
.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.card-header-row .section-title {
  margin-bottom: 0;
}

/* ── Project/Header Card ── */
.header-card {
  border-radius: var(--radius-lg);
  background-color: var(--surface-0);
  border: 1px solid var(--border-default);
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.header-card-top {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
@media (min-width: 640px) {
  .header-card-top {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
  }
}

.header-card-identity {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* 프로젝트 헤더 — 설정·셀프탈퇴를 제목 줄 우측 끝에 두어 제목과 수직 가운데 정렬(_tabs 전용 스코프).
   identity/wrapper를 풀폭으로 늘려 margin-left:auto가 카드 우측 끝까지 닿게 한다. */
.project-header-top .header-card-identity > div { width: 100%; min-width: 0; }
.project-header-top .header-card-titleline > .header-card-actions { margin-left: auto; }
@media (min-width: 640px) {
  .project-header-top .header-card-identity { flex: 1; min-width: 0; }
}

/* 내 역할 — 측·역할 배지(설명 문구 없음). 프로젝트 헤더. */
.project-my-role {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-top: 0.5rem;
}

.header-card-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* 타이틀 카드 하단 '설명' 서브섹션 — 상단과 옅은 구분선으로 분리 */
.header-card-description {
  margin-top: 0.875rem;
  padding-top: 0.875rem;
  border-top: 1px solid var(--border-subtle, var(--border-default));
}
.header-card-description-label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-tertiary);
}

/* ── Section Spacing ── */
.section-gap {
  margin-bottom: 1.5rem;
}

/* ── Skip Link ── */
.skip-link {
  position: absolute;
  left: -9999px;
  z-index: 100;
  padding: 0.5rem 1rem;
  background: var(--surface-0);
  color: var(--text-primary);
  font-size: 0.875rem;
  border-radius: var(--radius-md);
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

/* ── App Layout ── */
.app-layout {
  display: flex;
  height: 100vh;
}

.app-main {
  flex: 1;
  overflow-y: auto;
  min-width: 0;
}

/* ── Workspace Shell (3-zone layout) ── */
.workspace-shell {
  display: flex;
  flex: 1;
  overflow: hidden;
  height: 100%;
}
.content-main {
  flex: 1;
  overflow-y: auto;
  /* 컨테이닝 블록 확정 — abs 자식(.dropzone-input 등)이 html로 탈출해 윈도우 스크롤 생기는 것 방지 */
  position: relative;
}

/* ── Nav Rail — 데스크톱 고정 사이드바 / 모바일 좌측 오프캔버스 드로어(#615) ── */
.nav-rail {
  display: flex;
  flex-direction: column;
  width: 15rem;
  background-color: var(--nav-rail-bg, var(--surface-0));
  color: var(--nav-rail-text, inherit);
  border-right: 1px solid var(--border-subtle);
  padding: 1rem 0;
  flex-shrink: 0;
  /* 모바일: 상단 좌측 토글로 여는 드로어(하단 내비 대체) */
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 51;
  transform: translateX(-100%);
  transition: transform 200ms ease;
  overflow-y: auto;
}
.nav-rail.mobile-drawer-open {
  transform: translateX(0);
  box-shadow: var(--shadow-overlay);
}
@media (min-width: 1024px) {
  .nav-rail {
    position: relative;
    transform: none;
    z-index: 20;
    box-shadow: none;
    width: 13rem;
    overflow-y: visible;
  }
}

.nav-rail-brand {
  position: relative;
  padding: 0 0.5rem;
  margin-bottom: 1rem;
}

.nav-rail-brand-link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-width: 0;
}

.nav-rail-brand-logo {
  height: 2rem;
  width: 2rem;
  border-radius: var(--radius-lg);
  object-fit: cover;
  flex-shrink: 0;
}

.nav-rail-brand-static {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.375rem 0.5rem;
  min-width: 0;
}

.nav-rail-brand-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--nav-rail-text, var(--text-primary));
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-rail-brand-btn {
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-md);
  padding: 0.375rem 0.5rem;
}

.nav-rail-brand-btn:hover {
  background-color: var(--surface-hover);
}

.nav-rail-brand-btn:focus-visible,
.nav-rail-user-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.nav-rail-brand-chevron {
  flex-shrink: 0;
  color: var(--text-tertiary);
  margin-left: auto;
}

/* ── Workspace Switcher Menu ── */
.nav-rail-ws-menu {
  position: absolute;
  top: 100%;
  left: 0.5rem;
  right: 0.5rem;
  z-index: 50;
  background-color: var(--surface-0);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 0.5rem;
  margin-top: 0.25rem;
}

.nav-rail-ws-menu-group {
  margin-bottom: 0.5rem;
}

.nav-rail-ws-menu-label {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 0.25rem 0.5rem 0.5rem;
}

.nav-rail-ws-menu-item-indent {
  padding-left: 1.5rem;
}

.nav-rail-ws-menu-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--text-primary);
  text-decoration: none;
}

.nav-rail-ws-menu-item:hover {
  background-color: var(--surface-hover);
}

.nav-rail-ws-menu-item-active {
  background-color: var(--surface-active);
  font-weight: 500;
}

.nav-rail-ws-menu-separator {
  margin: 0.25rem 0;
}

.nav-rail-nav {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  padding: 0 0.75rem;
  flex: 1;
}

.nav-rail-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--nav-rail-text, var(--text-secondary));
  transition: all var(--transition-fast);
}

.nav-rail-item:hover {
  background-color: var(--surface-hover);
  color: var(--nav-rail-text, var(--text-primary));
}

.nav-rail-item:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.nav-rail-item-active {
  background-color: var(--nav-rail-active-bg, var(--surface-2));
  color: var(--nav-rail-text, var(--primary));
}

.nav-rail-spacer {
  margin-top: auto;
}

.nav-rail-powered {
  padding: 0 0.75rem;
  margin-bottom: 0.25rem;
}

.nav-rail-powered-label {
  font-size: 10px;
  color: var(--text-muted);
}

.nav-rail-powered-logo {
  font-size: 11px;
}

.nav-rail-user {
  position: relative;
  padding: 0 0.75rem;
  margin-top: 0.5rem;
}

/* ── Project shell rail (프로젝트 셸) ── */
.nav-rail-project-head {
  padding: 0 0.75rem;
  margin-bottom: 0.5rem;
}

.nav-rail-back {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.375rem;
  margin-bottom: 0.375rem;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.nav-rail-back:hover {
  background-color: var(--surface-hover);
  color: var(--text-primary);
}

.nav-rail-back-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-rail-project {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.375rem;
}

/* 프로젝트명 plain 헤더 — 전환 드롭다운은 breadcrumb 스위처로 이관 */
.nav-rail-project-name {
  min-width: 0;
  overflow: hidden;
  padding: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 전역(할일·알림) 섹션은 프로젝트 탭(flex:1) 아래로 — 늘어나지 않음 */
.nav-rail-global {
  flex: 0 0 auto;
}

/* 만료 콜라보 배너 — 본문(page-container)과 동일 그리드에 정렬(전체너비 방지, #606) */
.project-expired-banner {
  max-width: 80rem;
  margin-inline: auto;
  width: 100%;
  padding: 1rem 1.5rem 0;
}
@media (min-width: 1024px) {
  .project-expired-banner {
    padding: 1.5rem 3.5rem 0;
  }
}
/* 페이지가 자기 본문 컬럼 안에 직접 배치(좁은 product-doc 등) — 폭·좌우 정렬은 부모 컬럼이 결정(#631 후속). */
.project-expired-banner.is-inline {
  max-width: none;
  padding: 0;
  margin-bottom: 1.25rem;
}

/* ── Breadcrumb (Ui::Breadcrumb) — content-main 상단 위치 표시 ──
   page-container와 동일 그리드(max-width·좌우 패딩)에 정렬해 본문과 좌측 정렬 일치 */
.ui-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.375rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  max-width: 80rem;
  margin-inline: auto;
  width: 100%;
  padding: 1rem 1.5rem 0;
}
@media (min-width: 1024px) {
  .ui-breadcrumb {
    padding: 1.5rem 3.5rem 0;
  }
}

.ui-breadcrumb-link {
  color: var(--text-secondary);
  text-decoration: none;
}

.ui-breadcrumb-link:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

.ui-breadcrumb-sep {
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.ui-breadcrumb-current {
  color: var(--text-primary);
  font-weight: 600;
}

.nav-rail-user-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-lg);
  transition: background-color var(--transition-fast);
}

.nav-rail-user-btn:hover {
  background-color: var(--surface-hover);
}

.nav-rail-user-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--nav-rail-text, var(--text-primary));
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── User Menu (Dropdown) ── */
.user-menu {
  background-color: var(--surface-0);
  border-radius: var(--radius-lg);
  padding: 0.25rem 0;
  z-index: 50;
}

.user-menu-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.user-menu-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
}

.user-menu-company {
  font-size: 0.8125rem;
  color: var(--text-tertiary);
}

.user-menu-email {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.user-menu-item {
  display: flex;
  align-items: center;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  color: var(--text-primary);
  transition: background-color var(--transition-fast);
}

.user-menu-item:hover {
  background-color: var(--surface-hover);
}

.user-menu-signout {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  color: var(--destructive);
  transition: background-color var(--transition-fast);
}

.user-menu-signout:hover {
  background-color: var(--destructive-light);
}

.locale-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.user-menu-nav-rail {
  position: absolute;
  bottom: 0;
  left: calc(100% + 0.5rem);
  width: 14rem;
}

@media (max-width: 1023px) {
  .user-menu-nav-rail {
    right: 0;
    bottom: calc(100% + 0.5rem);
    left: 0;
    width: auto;
  }
}

.user-menu-mobile {
  position: absolute;
  right: 0;
  margin-top: 0.25rem;
  width: 14rem;
}

.user-menu-header-pos {
  position: absolute;
  right: 0;
  margin-top: 0.5rem;
  width: 14rem;
}

.menu-icon-gap {
  margin-right: 0.75rem;
}

.menu-separator {
  margin: 0.25rem 1rem;
}

/* ── Mobile Header Bar ── */
.mobile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 3rem;
  padding: 0 1rem;
  border-bottom: 1px solid var(--border-subtle);
}
@media (min-width: 1024px) {
  .mobile-header {
    display: none;
  }
}

.mobile-header-logo {
  height: 1.5rem;
  width: 1.5rem;
  border-radius: var(--radius-md);
  object-fit: cover;
  flex-shrink: 0;
}

.mobile-header-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-header-ws-toggle {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem;
  min-height: 2.75rem;
  min-width: 0;
  border-radius: var(--radius-md);
  transition: background-color var(--transition-fast);
}
.mobile-header-toggle-caret {
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.mobile-header-ws-toggle:hover {
  background-color: var(--surface-hover);
}

.mobile-header-user-btn {
  display: flex;
  align-items: center;
  padding: 0.5rem;
  min-height: 2.75rem;
  border-radius: var(--radius-lg);
  transition: background-color var(--transition-fast);
}

.mobile-header-user-btn:hover {
  background-color: var(--surface-hover);
}

/* ── Mobile nav 드로어 오버레이(nav-rail 드로어 배경) ── */
.mobile-drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  background-color: rgba(24, 24, 27, 0.5);
}
@media (min-width: 1024px) {
  .mobile-drawer-overlay {
    display: none !important;
  }
}
.mobile-drawer-overlay.mobile-drawer-visible {
  display: block;
}

/* ── App Header (non-workspace) ── */
.app-header {
  background-color: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--border-subtle);
}

.app-header-inner {
  max-width: 100rem;
  margin: 0 auto;
  padding: 0 1rem;
}

.app-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4rem;
}

.app-header-left {
  display: flex;
  align-items: center;
}

.app-header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.app-header-signin {
  font-size: 0.875rem;
  color: var(--text-primary);
  transition: opacity var(--transition-fast);
}

.app-header-signin:hover {
  opacity: 0.8;
}

/* 카드 그리드 — 가용 폭에 따라 reflow.
   auto-fit + 1fr로 빈 트랙 접고 남은 공간은 카드가 stretch 흡수.
   대시보드 보조 카드에서 사용. */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.card-grid > * {
  margin-bottom: 0;
  min-width: 0;
}

/* 콜라보 카드 — 포터블 홈 "참여중인 콜라보" 카드뷰(card-interactive 위에 패딩·레이아웃). */
.collabo-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem;
  cursor: pointer;
}

.collabo-card-name {
  font-weight: 600;
  color: var(--text-primary);
}

.collabo-card-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem;
}

.collabo-card-meta {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

/* 홈 — 워크스페이스 그룹: 워크스페이스(= IP 제공/파트너) 안에 콜라보 카드들이 담긴 패널.
   흰 바탕 + 외곽선으로 "이 워크스페이스의 콜라보들" 묶음을 워크스페이스 단위로만 구분. */
.home-ws-group {
  background: var(--surface-0);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem 1.25rem;
}

.home-ws-group-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.875rem;
  color: var(--text-muted);
}

.home-ws-group-name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
}

/* 콜라보 카드 그리드 — 캡 너비(카드 1개여도 full-width로 늘어나지 않음). 좌측 정렬·wrap. */
.collabo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 22rem));
  gap: 0.875rem;
  justify-content: start;
}

/* 앨범 그리드 — 시각 자산(IP 썸네일)용. 더 작은 min으로 한 줄에 4~5개 노출. */
.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.album-card-wrapper {
  position: relative;
}

.album-card-link {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: var(--radius-lg);
}

.album-card-link:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.album-card {
  display: flex;
  flex-direction: column;
  background-color: var(--surface-1);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-default);
  transition: border-color var(--transition-base);
  cursor: pointer;
}

.album-card-wrapper:hover .album-card {
  border-color: var(--surface-2);
}

.album-card-download-btn {
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--surface-2);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.album-card-download-btn:hover {
  background-color: var(--surface-hover);
  color: var(--text-primary);
}

.album-card-download-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.album-card-thumb {
  aspect-ratio: 1 / 1;
  background-color: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.album-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.album-card-meta {
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.album-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.album-card-footer-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  min-width: 0;
}

.dashboard-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  transition: background-color var(--transition-fast);
}

/* 워크스페이스 그룹 카드의 헤더 행 — 아래 프로젝트 목록을 담는 컨테이너 헤더 */
.dashboard-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.875rem 1rem;
}

.dashboard-list-item:hover {
  background-color: var(--surface-hover);
}

.dashboard-list-item-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.dashboard-list-item-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-list-item-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.dashboard-list-item.unread {
  background-color: var(--surface-hover);
}

.dashboard-list-item-trailing {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* 상태 배지와 액션 버튼 위계 분리 — 둘 다 있으면 구분선으로 "상태(읽기) | 행동(누르기)" 구분 */
.dashboard-list-item-actions {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.dashboard-list-item-actions.has-divider {
  padding-left: 0.625rem;
  border-left: 1px solid var(--border-subtle);
}

.dashboard-list-item-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}

@media (max-width: 40rem) {
  .dashboard-list-item {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.75rem;
  }

  .dashboard-list-item-left,
  .dashboard-list-item-link {
    width: 100%;
  }

  .dashboard-list-item-name {
    white-space: normal;
  }

  .dashboard-list-item-trailing {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .dashboard-list-item-actions.has-divider {
    padding-left: 0;
    border-left: 0;
  }
}

.notification-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background-color: var(--primary);
  flex-shrink: 0;
}


/* ── Quick Actions ── */
.quick-action-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
}

.quick-action-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 2rem;
  width: 2rem;
  border-radius: var(--radius-lg);
  background-color: var(--surface-2);
}

.quick-action-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
}

.quick-action-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Stat Card Icon ── */
.stat-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 2.5rem;
  width: 2.5rem;
  border-radius: var(--radius-lg);
  background-color: var(--surface-2);
}

.stat-card-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ── Action Item ── */
.action-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  min-height: 2.75rem;
  transition: background-color var(--transition-fast);
  text-decoration: none;
  color: inherit;
}

.action-item:hover {
  background-color: var(--surface-hover);
}

.action-item:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus-ring);
}

.action-item-urgency {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.action-item-urgency-high { background-color: var(--destructive); }
.action-item-urgency-normal { background-color: var(--status-warning); }
.action-item-urgency-low { background-color: var(--text-tertiary); }

.action-item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 2rem;
  width: 2rem;
  border-radius: var(--radius-md);
  background-color: var(--surface-2);
  flex-shrink: 0;
}

.action-item-content {
  flex: 1;
  min-width: 0;
}

.action-item-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.action-item-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.action-item-badge {
  flex-shrink: 0;
}

/* ── Activity Entry ── */
.activity-entry {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
}

.activity-entry-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 1.5rem;
  width: 1.5rem;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.activity-entry-content {
  flex: 1;
  min-width: 0;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.activity-entry-description {
  color: var(--text-primary);
}

.activity-entry-actor {
  color: var(--text-muted);
}

.activity-entry-actor::before {
  content: " · ";
}

.activity-entry-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
  white-space: nowrap;
}

/* ── Summary Bar ── */
.summary-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.summary-bar-item {
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
  padding: 0.5rem 0.75rem;
  min-height: 2.75rem;
  border-radius: var(--radius-md);
  background-color: var(--surface-1);
  text-decoration: none;
  color: inherit;
  transition: background-color var(--transition-fast);
}

.summary-bar-item:hover {
  background-color: var(--surface-hover);
}

.summary-bar-item:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus-ring);
}

.summary-bar-count {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.summary-bar-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* ── Dashboard Hero ── */
.dashboard-hero {
  margin-bottom: 1.5rem;
}

.dashboard-hero-greeting {
  font-size: 1.375rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.dashboard-hero-summary {
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-wrap: balance;
}

/* ── Dashboard redesign: calm command surface ──
   '내 할일' 액션 큐를 큰 포컬 카운트로 주인공화. 브랜드 레드(--cta)는 긴급에만. */
.dash-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.5rem 1.75rem;
  background-color: var(--surface-0);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-subtle);
}

.dash-hero-main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.35rem;
  min-width: 0;
}

.dash-hero-eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.dash-hero-title {
  font-size: 1.6rem;
  font-weight: 650;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}


/* 섹션 헤더의 카운트 핀 */
/* 스태거 등장 — 한 번의 정돈된 페이지 로드 */
@keyframes dashRise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.dashboard-page > * {
  animation: dashRise 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.dashboard-page > *:nth-child(1) { animation-delay: 0.02s; }
.dashboard-page > *:nth-child(2) { animation-delay: 0.08s; }
.dashboard-page > *:nth-child(3) { animation-delay: 0.14s; }
.dashboard-page > *:nth-child(4) { animation-delay: 0.20s; }
.dashboard-page > *:nth-child(5) { animation-delay: 0.26s; }
.dashboard-page > *:nth-child(6) { animation-delay: 0.32s; }

@media (prefers-reduced-motion: reduce) {
  .dashboard-page > * { animation: none; }
}

@media (max-width: 640px) {
  .dash-hero {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 1.25rem;
  }
}

/* ── Form Section (settings pages) ── */
.form-page {
  max-width: 42rem;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.form-section-header {
  margin-bottom: 1rem;
}

/* Form column (단일 column 입력) — 80rem 카드 안에서 line-length 통제.
 * Tailwind utility class와 충돌 없도록 prefix 사용. .form-column으로 wrap. */
.form-column {
  max-width: 40rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* 2-col field grid (form 필드 5+ 시). 긴 필드는 .form-grid-full로 row 전체 차지. */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
  gap: 1rem 1.5rem;
}

.form-grid-full {
  grid-column: 1 / -1;
}

/* Header Card (카드 유형 #1) */
/* 상세 페이지 entity 헤더 — 박스 없이 제목 영역. 본문과 border-bottom으로만 구분 */
.entity-header {
  padding-bottom: 1.25rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.entity-header-desc {
  margin-top: 0.75rem;
}

.header-card-back {
  margin-bottom: 0.75rem;
}

.header-card-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.header-card-identity {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}

.header-card-titlewrap {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.header-card-titleline {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex-wrap: wrap;
}

.header-card-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* 헤더에 올린 리뷰 바(_review_action_bar)의 사유 입력 폼은 헤더 카드 바로 아래 전체폭으로 펼침. */
.entity-header ~ .review-reason { margin-top: 0.75rem; }

.form-section-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 0.125rem;
}

.form-section-row {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.form-section-row:last-child {
  border-bottom: none;
}

.form-section-row-inner {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
@media (min-width: 640px) {
  .form-section-row-inner {
    flex-direction: row;
    align-items: center;
    gap: 1rem;
  }
}

.form-section-label {
  flex-shrink: 0;
  margin-bottom: 0;
}
@media (min-width: 640px) {
  .form-section-label {
    width: 10rem;
  }
}

.form-section-field {
  flex: 1;
}
@media (min-width: 640px) {
  .form-section-field {
    max-width: 24rem;
  }
}

/* ── Danger Zone ── */
.danger-section {
  margin-top: 2rem;
}

.danger-card {
  border-radius: var(--radius-lg);
  background-color: var(--surface-0);
  border: 1px solid var(--border-default);
  border: 1px solid var(--destructive-border);
}

.danger-card-inner {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
}
@media (min-width: 640px) {
  .danger-card-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.danger-card-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
}

.danger-card-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.125rem;
}

/* ── Workspace Card (dashboard page) ── */
.workspace-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 768px) {
  .workspace-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.workspace-card-body {
  padding: 1.5rem;
}

/* 전체 카드를 클릭 가능한 link로 — 기본 text 스타일 제거, .card-interactive 호버 유지 */
.workspace-card-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.workspace-card-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.workspace-card-info {
  flex: 1;
  min-width: 0;
}

.workspace-card-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-card-meta {
  display: flex;
  align-items: center;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 0.125rem;
}

/* ── Card Divider ── */
.card-divided > * + * {
  border-top: 1px solid var(--border-subtle);
}

/* ── Icon Utility ── */
.icon-shrink {
  flex-shrink: 0;
}

/* ── Form Field ── */
.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 1.25rem;
}

.form-field:last-of-type {
  margin-bottom: 1.5rem;
}

.form-field-compact,
.form-field-compact:last-of-type {
  min-width: 0;
  margin-bottom: 0;
}

.form-field-compact .select {
  max-width: 100%;
}

.member-picker {
  position: relative;
  display: inline-flex;
  max-width: 100%;
}

.member-picker-trigger,
.member-picker-value {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  min-height: 2.5rem;
  max-width: 100%;
  padding: 0.25rem 0.5rem;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-primary);
  text-align: left;
}

.member-picker-trigger {
  cursor: pointer;
  transition: background-color var(--transition-fast), border-color var(--transition-fast);
}

.member-picker-trigger:hover {
  background: var(--surface-hover);
  border-color: var(--border-subtle);
}

.member-picker-trigger:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.member-picker-trigger .member-display,
.member-picker-value .member-display {
  min-width: 0;
}

.member-picker-chevron {
  flex-shrink: 0;
  color: var(--text-muted);
}

.member-picker-placeholder {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
}

.member-picker-menu {
  width: min(20rem, calc(100vw - 2rem));
  max-height: min(22rem, calc(100vh - 6rem));
  overflow-y: auto;
  padding: 0.5rem;
}

.member-picker-option-form {
  margin: 0;
}

.member-picker-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  min-height: 2.75rem;
  padding: 0.5rem 0.75rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
}

.member-picker-option:hover,
.member-picker-option:focus-visible {
  background: var(--surface-hover);
}

.member-picker-option:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.member-picker-option-current {
  background: var(--surface-1);
  cursor: default;
}

.member-picker-option .member-display {
  min-width: 0;
}

.member-picker-check {
  flex-shrink: 0;
  color: var(--primary);
}

.member-picker-add .member-picker-trigger {
  min-height: 2rem;
  padding-inline: 0.5rem;
  color: var(--text-secondary);
}

/* assign — 담당자 미배정 상태를 outline 버튼으로 강조(클릭 가능한 액션임을 명확히). */
.member-picker-assign .member-picker-trigger {
  padding: 0.375rem 0.75rem;
  border-color: var(--border-subtle);
  background: var(--surface-1);
}

.member-picker-assign .member-picker-trigger:hover {
  background: var(--surface-hover);
  border-color: var(--border-default);
}

.member-picker-assign .member-picker-placeholder {
  color: var(--text-primary);
  font-weight: 600;
}

.member-picker-assign .member-picker-chevron {
  color: var(--text-secondary);
}

.member-picker .member-display-name {
  max-width: 12rem;
  font-size: 0.875rem;
}

.member-picker .member-display-company {
  max-width: 12rem;
  font-size: 0.75rem;
}

.approval-assignee-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.25rem 0;
}

.approval-assignee-header,
.approval-line-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.approval-assignee-header .section-title,
.approval-line-header .section-title {
  margin-bottom: 0;
}

.approval-assignee-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.approval-line-steps {
  display: flex;
  flex-direction: column;
}

.approval-line-step {
  position: relative;
  display: grid;
  grid-template-columns: 1.75rem minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  min-height: 4rem;
}

.approval-line-step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: calc(50% + 0.875rem);
  bottom: calc(-50% + 0.875rem);
  left: 0.84375rem;
  width: 1px;
  background: var(--border-default);
}

.approval-line-step-marker {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border: 1px solid var(--border-default);
  border-radius: 999px;
  background: var(--surface-0);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
}

.approval-line-step-summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  flex-wrap: wrap;
}

.approval-line-step-label {
  min-width: 4.5rem;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 500;
}

.approval-line-step-actions {
  flex-shrink: 0;
}

@media (max-width: 480px) {
  .approval-line-step {
    align-items: start;
    min-height: 0;
    padding-block: 0.5rem;
  }

  .approval-line-step:not(:last-child)::after {
    top: 2.25rem;
    bottom: -0.5rem;
  }

  .approval-line-step-summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.25rem 0.5rem;
  }

  .approval-line-step-label {
    grid-column: 1 / -1;
    min-width: 0;
  }

  .approval-line-step-actions {
    align-self: start;
    margin-top: 1rem;
  }

  .member-picker-trigger,
  .member-picker-add .member-picker-trigger {
    min-height: 2.75rem;
  }
}

/* ── Required Indicator ── */
.label-required::after {
  content: " *";
  color: var(--destructive);
}

/* ── Form Check (checkbox/radio inline) ── */
/* 폼 최상위 자식 간 세로 간격 — 뷰에서 raw 유틸 대신 사용 */
.form-stack > * + * {
  margin-block-start: 1.5rem;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-check-input {
  cursor: pointer;
}

.form-check-label {
  margin-bottom: 0;
  cursor: pointer;
}

/* ── Radio Label ── */
.radio-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

/* ── Text Utilities ── */
.text-strong {
  color: var(--text-primary);
  font-weight: 500;
}

.text-destructive {
  color: var(--destructive);
}

/* ── Button Danger Outline ── */
.btn-danger-outline {
  color: var(--destructive);
  border-color: var(--destructive-border);
}

.btn-danger-outline:hover {
  background-color: var(--destructive-light);
}

/* ── Nav Rail Separator ── */
.nav-rail-separator {
  margin: 0 1rem 0.5rem;
}

/* ── Nav Rail Active Color ── (데스크톱 rail은 배경 하이라이트로도 구분) */
.nav-rail-item-active {
  color: var(--primary);
}
/* ── App Header Logo ── */
.app-header-logo {
  font-size: 1.5rem;
}

/* ── Shadow Utilities ── */
.shadow-elevated {
  box-shadow: var(--shadow-elevated);
}

.shadow-dropdown {
  box-shadow: var(--shadow-dropdown);
}

/* ── Spacing Utilities ── */
.gap-bottom-sm {
  margin-bottom: 0.75rem;
}

.gap-left-sm {
  margin-left: 0.5rem;
}

/* ── Dropzone ── */
.dropzone {
  border: 2px dashed var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.dropzone:hover {
  background-color: var(--surface-hover);
}

.dropzone--dragover {
  border-color: var(--primary);
  background-color: var(--surface-2);
}

/* 클라 파일 필수 가드(file_required_controller)가 비어 있는 필수 dropzone에 표시 */
.dropzone--error {
  border-color: var(--destructive);
}

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

.dropzone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
}

.dropzone-icon {
  color: var(--text-tertiary);
}

.dropzone-preview {
  max-height: 96px;
  max-width: 100%;
  border-radius: var(--radius-md);
  object-fit: contain;
}

.dropzone-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.dropzone-link {
  color: var(--primary);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.dropzone-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.dropzone-filename {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-top: 0.25rem;
}

.dropzone-progress {
  width: min(100%, 24rem);
  margin-top: 0.5rem;
}

.dropzone-progress-track {
  height: 0.375rem;
  overflow: hidden;
  border-radius: var(--radius-full);
  background-color: var(--surface-2);
}

.dropzone-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background-color: var(--primary);
  transition: width var(--transition-fast);
}

.dropzone-progress-text {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Lexxy 내부 첨부 업로드 progress도 일반 파일 업로드와 같은 토큰/형태로 보이게 맞춘다. */
lexxy-editor .attachment progress {
  width: min(100%, 10rem);
  max-inline-size: 10rem;
  height: 0.375rem;
  appearance: none;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-full);
  background-color: var(--surface-2);
  accent-color: var(--primary);
}

lexxy-editor .attachment progress::-webkit-progress-bar {
  border-radius: var(--radius-full);
  background-color: var(--surface-2);
}

lexxy-editor .attachment progress::-webkit-progress-value {
  border-radius: var(--radius-full);
  background-color: var(--primary);
}

lexxy-editor .attachment progress::-moz-progress-bar {
  border-radius: var(--radius-full);
  background-color: var(--primary);
}

/* ── Dialog ── */
dialog.dialog-panel {
  border: none;
  border-radius: var(--radius-lg);
  background: var(--surface-0);
  box-shadow: var(--shadow-overlay);
  flex-direction: column;
  padding: 0;
  margin: auto;
  max-height: calc(100vh - 4rem);
  max-width: calc(100vw - 2rem);
}

dialog.dialog-panel::backdrop {
  background: rgba(24, 24, 27, 0.4);
  backdrop-filter: blur(4px);
}

.dialog-sm { width: 28rem; }
.dialog-md { width: 32rem; }
.dialog-lg { width: 42rem; }

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1.5rem 1.5rem 0;
}

.dialog-body {
  padding: 1rem 1.5rem;
  overflow-y: auto;
}

.dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0 1.5rem 1.5rem;
}

@keyframes dialogIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes backdropIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes dialogOut {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(0.95); }
}

@keyframes backdropOut {
  from { opacity: 0; }
  to { opacity: 0; }
}

dialog.dialog-panel[open] {
  display: flex;
  animation: dialogIn var(--transition-base);
}

dialog.dialog-panel[open]::backdrop {
  animation: backdropIn var(--transition-base);
}

dialog.dialog-panel.dialog-closing {
  animation: dialogOut var(--transition-fast);
}

dialog.dialog-panel.dialog-closing::backdrop {
  animation: backdropOut var(--transition-fast);
}

/* Dialog 닫기 버튼 (Ui::Modal) */
.dialog-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* 터치 타깃 44px(WCAG 2.5.5) */
  min-width: 2.75rem;
  min-height: 2.75rem;
  border-radius: var(--radius-sm);
  border: 0;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.dialog-close:hover {
  background: var(--surface-2);
  color: var(--text-primary);
}

/* ── Dropdown (Ui::Dropdown — dropdown_controller) ── */
.dropdown {
  position: relative;
  display: inline-flex;
}
.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  min-width: 11rem;
  max-width: calc(100vw - 2rem);
  overflow: auto;
  z-index: 30;
  background: var(--surface-0);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-overlay);
  padding: 0.25rem;
  /* 기본 숨김. 언레이어 .dropdown-menu가 Tailwind .hidden(utilities 레이어)을
     캐스케이드로 눌러 항상 열리던 버그 회피 — display는 .hidden 토글로만 제어. */
  display: none;
}
.dropdown-menu:not(.hidden) {
  display: flex;
  flex-direction: column;
}
.dropdown-menu-start { left: 0; }
.dropdown-menu-end { right: 0; }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.625rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.875rem;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.dropdown-item:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}
/* 상태 변경 옵션 — 단계명(좌) + 힌트(우, 이전 단계/승인 필요) */
.stage-option-name { flex: 1; }
.stage-option-hint {
  font-size: 0.6875rem;
  color: var(--text-muted);
}
.stage-option-hint-gate { color: #92400e; }
.dropdown-item-danger { color: var(--destructive-dark); }
.dropdown-item-danger:hover {
  background: var(--destructive-light);
  color: var(--destructive-dark);
}
.dropdown-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 0.25rem 0;
}

/* ── Tooltip (Ui::Tooltip — CSS only) ── */
.tooltip {
  position: relative;
  display: inline-flex;
  outline: none;
}
/* 키보드 포커스 가시성 — tabindex=0 트리거에 포커스 링(마우스는 outline:none 유지). */
.tooltip:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
.tooltip-bubble {
  position: absolute;
  left: 50%;
  z-index: 40;
  white-space: nowrap;
  pointer-events: none;
  background: var(--text-primary);
  color: var(--text-inverse);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.4;
  padding: 0.375rem 0.5rem;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-overlay);
  opacity: 0;
  visibility: hidden;
  transform: translateX(-50%) translateY(4px);
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}
.tooltip-top .tooltip-bubble { bottom: calc(100% + 6px); }
.tooltip-bottom .tooltip-bubble { top: calc(100% + 6px); transform: translateX(-50%) translateY(-4px); }
.tooltip:hover .tooltip-bubble,
.tooltip:focus-within .tooltip-bubble {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}
/* 용어 설명용 도움말 트리거(?/ⓘ 아이콘) */
.tip-trigger {
  display: inline-flex;
  align-items: center;
  color: var(--text-tertiary);
  cursor: help;
}
.tip-trigger:hover { color: var(--text-secondary); }

/* ── Accordion (Ui::Accordion — native <details>) ── */
.accordion {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--surface-0);
  overflow: hidden;
}
.accordion-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  cursor: pointer;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  list-style: none;
}
.accordion-summary::-webkit-details-marker { display: none; }
.accordion-summary:hover { background: var(--surface-hover); }
.accordion-icon {
  display: inline-flex;
  color: var(--text-tertiary);
  transition: transform var(--transition-fast);
}
.accordion[open] .accordion-icon { transform: rotate(180deg); }
.accordion-body {
  padding: 0 1rem 1rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* Tab panel (Ui::Tabs — .tab-nav/.tab-item 재사용) */
.tab-panel { padding-top: 1rem; }

/* ── Switch (Ui::Switch — CSS only) ── */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}
.switch-disabled { cursor: not-allowed; opacity: 0.6; }
.switch-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.switch-track {
  position: relative;
  width: 2.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  transition: background var(--transition-fast);
}
.switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 1rem;
  height: 1rem;
  border-radius: var(--radius-full);
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: transform var(--transition-fast);
}
.switch-input:checked + .switch-track { background: var(--cta); }
.switch-input:checked + .switch-track .switch-thumb { transform: translateX(1rem); }
.switch-input:focus-visible + .switch-track { box-shadow: var(--shadow-focus-ring); }
.switch-label { font-size: 0.875rem; color: var(--text-primary); }

/* ── Skeleton (Ui::Skeleton — 로딩 시머) ── */
@keyframes skeletonShimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}
.skeleton {
  display: block;
  background: linear-gradient(90deg, var(--surface-1) 25%, var(--surface-2) 37%, var(--surface-1) 63%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
.skeleton-text { height: 0.75rem; border-radius: var(--radius-full); }
.skeleton-block { height: 5rem; }
.skeleton-circle { width: 2.5rem; height: 2.5rem; border-radius: var(--radius-full); }
@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
}

/* ── Pagination (Ui::Pagination) ── */
.pagination {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.pagination-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.5rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-decoration: none;
  cursor: pointer;
}
.pagination-item:hover { background: var(--surface-hover); color: var(--text-primary); }
.pagination-active,
.pagination-active:hover {
  background: var(--primary);
  color: var(--text-inverse);
  font-weight: 600;
}
.pagination-disabled {
  color: var(--text-tertiary);
  cursor: not-allowed;
}
.pagination-gap { padding: 0 0.25rem; color: var(--text-tertiary); }

/* ── Progress Steps ── */
.progress-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.progress-step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
}

.progress-step-dot {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: var(--radius-full);
  background-color: var(--surface-3);
}

/* 진행 표시는 모노크롬 — 레드는 CTA/에러 전용, 그린 대신 다크 zinc로 통일 */
.progress-step-current .progress-step-dot {
  background-color: var(--primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 12%, transparent);
}

.progress-step-completed .progress-step-dot {
  background-color: var(--primary);
}

.progress-step-icon {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: var(--radius-full);
  background-color: var(--primary);
  color: var(--text-inverse);
  display: flex;
  align-items: center;
  justify-content: center;
}

.progress-step-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}

.progress-step-current .progress-step-label {
  color: var(--text-primary);
  font-weight: 600;
}

.progress-step-completed .progress-step-label {
  color: var(--text-secondary);
}

.progress-step-connector {
  flex: 1;
  height: 2px;
  min-width: 2rem;
  background-color: var(--surface-3);
  align-self: flex-start;
  margin-top: 0.3125rem;
}

.progress-step-connector-completed {
  background-color: var(--primary);
}

@media (max-width: 639px) {
  .progress-steps {
    flex-direction: column;
    align-items: flex-start;
  }

  .progress-step {
    flex-direction: row;
  }

  .progress-step-connector {
    width: 2px;
    height: 1.5rem;
    min-width: unset;
    margin-top: 0;
    margin-left: 0.3125rem;
  }
}

/* ── Workflow Guide ── */
.workflow-steps {
  display: flex;
  align-items: flex-start;
  padding: 0 1rem 1rem;
  gap: 0;
}

.workflow-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.workflow-step-indicator {
  margin-bottom: 0.5rem;
}

.workflow-step-icon {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
}

.workflow-step-icon-done {
  background-color: var(--status-success);
  color: var(--text-inverse);
}

.workflow-step-icon-active {
  background-color: var(--primary);
  color: var(--text-inverse);
}

.workflow-step-icon-pending {
  background-color: var(--surface-2);
  color: var(--text-tertiary);
}

.workflow-step-body {
  text-align: center;
  min-width: 0;
}

.workflow-step-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.workflow-step-pending .workflow-step-label {
  color: var(--text-muted);
}

.workflow-step-count {
  font-size: 0.6875rem;
  color: var(--text-secondary);
  margin-top: 0.125rem;
}

.workflow-connector {
  flex-shrink: 0;
  width: 2rem;
  height: 2px;
  background-color: var(--surface-3);
  margin-top: 0.875rem;
}

.workflow-connector-done {
  background-color: var(--status-success);
}

@media (max-width: 639px) {
  .workflow-steps {
    flex-direction: column;
    gap: 0;
  }

  .workflow-step {
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
  }

  .workflow-step-indicator {
    margin-bottom: 0;
  }

  .workflow-step-body {
    text-align: left;
  }

  .workflow-connector {
    width: 2px;
    height: 1.25rem;
    margin-top: 0;
    margin-left: 0.875rem;
  }
}

.gap-bottom-md {
  margin-bottom: 1rem;
}

.gap-bottom-lg {
  margin-bottom: 1.5rem;
}

/* page-container 변형 — 일관성 정책:
 *
 * .page-container          (80rem, 기본) — 데이터/리스트/상세/대시보드/관리 폼 등 대부분의 페이지
 * .page-container-readable (60rem)       — 글 본문(post show, 마케팅·약관) 같이 line-length가 중요한 페이지 전용
 * .page-container-narrow   (40rem)       — auth 폼(로그인/회원가입/상태) 같이 단일 column 진입점 전용
 *
 * data/detail 페이지엔 readable 적용 금지 — 80rem 기본을 쓸 것.
 */
.page-container-narrow {
  max-width: 40rem;
  margin-left: auto;
  margin-right: auto;
}

.page-container-readable {
  max-width: 60rem;
  margin-left: auto;
  margin-right: auto;
}

/* 단일 컬럼 폼(FormCard :single = .form-column) 페이지는 카드를 폼 폭으로 좁혀
   가운데 정렬 — 80rem 카드 안에서 입력이 40rem만 차서 우측이 비는 문제 해소.
   container가 유일한 width 소스. :has로 자동 적용(뷰마다 클래스 추가 불필요).
   2-col 폼(.form-grid)은 넓은 폭 유지. */
.page-container:has(.form-column) {
  max-width: 46rem;
}
.page-container:has(.form-column) .form-column {
  max-width: none;
}

/* ── Nav Badge ── */
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.375rem;
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1;
  color: var(--text-inverse);
  background-color: var(--destructive);
  border-radius: var(--radius-full);
}

/* ── File Preview ── */
.file-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: 0.75rem;
}

.file-preview {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: relative;
}

.file-preview-open {
  display: block;
  border-radius: var(--radius-md);
}

.file-preview-open:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus-ring);
}

.file-preview-download {
  position: absolute;
  top: 0.375rem;
  right: 0.375rem;
  width: 1.75rem;
  height: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(255, 255, 255, 0.92);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  color: var(--text-primary);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.file-preview:hover .file-preview-download,
.file-preview-download:focus-visible {
  opacity: 1;
}

.file-preview-media {
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: var(--radius-md);
}

.file-preview-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.file-preview-doc {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--surface-2);
  color: var(--text-tertiary);
}

.file-preview-info {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
}

.file-preview-name {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-preview-label {
  position: absolute;
  top: 0.375rem;
  left: 0.375rem;
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  font-size: 0.6875rem;
  font-weight: 500;
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-sm);
}

/* ── IP Asset 파일 편집 (기존 파일 그리드 + 개별 제거) ── */
.file-edit-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.file-edit-item {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.file-edit-remove {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  cursor: pointer;
}

/* 썸네일(이미지) 없을 때의 파일유형 폴백 아이콘 — 헤더 아바타 슬롯 / 앨범 썸네일 */
.file-type-fallback {
  background-color: var(--surface-2);
  color: var(--text-muted);
}

.album-card-thumb .album-card-thumb-icon {
  width: 2.5rem;
  height: 2.5rem;
  color: var(--text-tertiary);
}

/* ── Accessibility: Reduced Motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── System Admin Shell ── */
.admin-shell {
  background: var(--surface-1);
  min-height: 100vh;
}

/* admin scope에선 카드 간 spacing을 더 넓게 — 시각적 그룹 구분 명확 */
.admin-shell .page-container {
  gap: 1.5rem;
}
.admin-bar {
  background: #111111;
  color: #ffffff;
  border-bottom: 3px solid #e62121;
}
.admin-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  max-width: 80rem;
  margin: 0 auto;
}
.admin-bar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
}
.admin-bar-badge {
  background: #e62121;
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}
.admin-bar-title {
  font-size: 0.95rem;
}
.admin-bar-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.admin-nav-link {
  color: #cccccc;
  font-size: 0.875rem;
  text-decoration: none;
}
.admin-nav-link:hover {
  color: #ffffff;
}
.admin-nav-link-button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.admin-bar-user {
  font-size: 0.85rem;
  color: #999999;
}
.admin-main {
  padding-top: 1rem;
}
.admin-flash {
  max-width: 80rem;
  margin: 0 auto 1rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
}
.admin-flash-notice {
  background: #e8f5e9;
  color: #1b5e20;
}
.admin-flash-alert {
  background: #ffebee;
  color: #b71c1c;
}

/* ── Admin Tabs (workspace_requests 등) ── */
.admin-tabs {
  display: flex;
  gap: 0.25rem;
  margin: 1.5rem 0 1rem;
  padding: 0;
  border-bottom: 1px solid var(--border-subtle);
}

.admin-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.admin-tab:hover {
  color: var(--text-primary);
  border-bottom-color: var(--surface-3);
}

.admin-tab-active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

.admin-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.375rem;
  border-radius: var(--radius-full);
  background-color: var(--surface-2);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
}

.admin-tab-active .admin-tab-count {
  background-color: var(--primary);
  color: var(--text-inverse);
}

/* ── Marketing Landing ── */
.marketing-hero {
  min-height: calc(100vh - 4rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 1.5rem;
  background-color: var(--surface-1);
  text-align: center;
}

.marketing-hero > * {
  max-width: 42rem;
}

.marketing-headline {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.marketing-sub {
  font-size: 1.125rem;
  color: var(--text-secondary);
  margin-bottom: 2.5rem;
  line-height: 1.65;
}

.marketing-cta-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.marketing-secondary-link {
  color: var(--text-secondary);
  font-size: 0.875rem;
  text-decoration: underline;
  text-underline-offset: 4px;
  transition: color var(--transition-fast);
}

.marketing-secondary-link:hover {
  color: var(--text-primary);
}

@media (min-width: 768px) {
  .marketing-headline {
    font-size: 3.5rem;
  }

  .marketing-sub {
    font-size: 1.25rem;
  }
}

/* ── Slug input (Slack-style prefix/suffix) ── */
.slug-input-group {
  display: flex;
  align-items: stretch;
  width: 100%;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background-color: var(--surface-0);
  overflow: hidden;
  transition: all var(--transition-fast);
}

.slug-input-group:focus-within {
  border-color: var(--primary);
  box-shadow: var(--shadow-focus-ring);
}

.slug-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--text-primary);
  background: transparent;
  border: 0;
  outline: 0;
}

.slug-input::placeholder {
  color: var(--text-muted);
}

.slug-prefix {
  display: flex;
  align-items: center;
  padding: 0 0.75rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  background-color: var(--surface-1);
  border-right: 1px solid var(--border-subtle);
  user-select: none;
  white-space: nowrap;
}

.slug-feedback {
  min-height: 1.25rem;
  margin-top: 0.375rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.slug-feedback[data-status="ok"] {
  color: var(--status-success-dark);
}

.slug-feedback[data-status="error"] {
  color: var(--destructive);
}

.slug-feedback[data-status="pending"] {
  color: var(--text-muted);
}

/* ── Onboarding Steps (workspace_request new / submitted) ── */
.onboarding-steps {
  display: flex;
  gap: 0.5rem;
  margin: 0 0 1.5rem 0;
  padding: 0;
  list-style: none;
}

.onboarding-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.625rem 0.75rem 0.75rem;
  border-top: 3px solid var(--surface-2);
}

.onboarding-step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: var(--radius-full);
  background-color: var(--surface-2);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
}

.onboarding-step-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.onboarding-step-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.onboarding-step-current {
  border-top-color: var(--cta);
}
.onboarding-step-current .onboarding-step-number {
  background-color: var(--cta);
  color: var(--text-inverse);
}
.onboarding-step-current .onboarding-step-label {
  color: var(--text-primary);
}

.onboarding-step-done {
  border-top-color: var(--status-success);
}
.onboarding-step-done .onboarding-step-number {
  background-color: var(--status-success);
  color: var(--text-inverse);
}
.onboarding-step-done .onboarding-step-label {
  color: var(--text-secondary);
}

@media (max-width: 640px) {
  .onboarding-steps {
    flex-direction: column;
    gap: 0.25rem;
  }
  .onboarding-step {
    flex-direction: row;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.5rem 0 0.5rem 0.75rem;
    border-top: none;
    border-left: 3px solid var(--surface-2);
  }
  .onboarding-step-current { border-left-color: var(--cta); }
  .onboarding-step-done { border-left-color: var(--status-success); }
  .onboarding-step-hint { margin-left: auto; }
}
