/* 공통 앱 셸 스타일 (base.twig 에서 추출 — DATALK-160)
   디자인 토큰 · 다크모드 · 사이드바 · 카드 · 모달 · 스켈레톤 · 토스트 등.
   Twig 의존이 없는 순수 CSS 만 추출해 캐시 가능한 정적 자산으로 분리했다.
   (스킨 색상은 base.twig 인라인 pre-paint 스크립트가 :root 인라인 스타일로 덮어씀 —
    아래 :root 기본값은 폴백일 뿐이다.)
   브랜드 토큰 SSoT 는 brand.css — 이 파일보다 먼저 로드되어야 한다.
   접근성(DATALK-161): --text-hint · .btn-primary 대비 개선 표시. */
:root {
    /* --primary 계열: 스킨 pre-paint 인라인이 덮어쓰는 구조 — 기본값만 brand 토큰 참조 */
    --primary: var(--brand-orange);
    --primary-dark: #E03A00;
    --primary-light: #FF6B40;
    --primary-text-on-bg: #FFFFFF;
    /* 새 브랜드 디자인 언어(brand.css SSoT): coral 보조색 + ink/muted/line 뉴트럴 */
    --secondary: var(--brand-coral);
    --success: #00C853;
    --error: #FF5252;
    --male: #2196F3;
    --female: #E91E63;
    --text-primary: var(--brand-ink);
    --text-secondary: var(--brand-muted);
    /* DATALK-161: 라이트모드 힌트색 #9E9E9E → #6B6B6B.
       #F5F5F5 배경 위 10px 법적/타임스탬프 텍스트 대비 ~2.6:1 → ~4.8:1.
       다크모드는 아래 html.dark 에서 #71717A 로 별도 지정하므로 영향 없음. */
    --text-hint: #6B6B6B;
    --surface: var(--brand-bg);
    --surface-variant: var(--brand-line);
    --sidebar-width: 240px;
    --sidebar-collapsed-width: 72px;
    --card-bg: #FFFFFF;
}
/* Dark Mode - 설계 문서 기준 색상 */
html.dark {
    --text-primary: #F5F5F5;
    --text-secondary: #A1A1AA;
    --text-hint: #71717A;
    --surface: #0D0D0F;
    --surface-variant: #18181B;
    --card-bg: #18181B;
    --divider: #27272A;
}
html.dark body {
    background-color: #0D0D0F;
}
html.dark .bg-white {
    background-color: var(--card-bg) !important;
}
html.dark .bg-gray-50,
html.dark .bg-gray-100 {
    background-color: var(--surface) !important;
}
/* 다크모드 텍스트 색상 */
html.dark .text-gray-500,
html.dark .text-gray-600,
html.dark .text-gray-700 {
    color: var(--text-secondary) !important;
}
html.dark .text-gray-400 {
    color: var(--text-hint) !important;
}
html.dark .text-gray-800,
html.dark .text-gray-900,
html.dark .text-black {
    color: var(--text-primary) !important;
}
/* 다크모드 테두리 색상 */
html.dark .border,
html.dark .border-gray-100,
html.dark .border-gray-200,
html.dark .border-gray-300 {
    border-color: var(--divider) !important;
}
/* 다크모드 hover 배경 */
html.dark .hover\:bg-gray-50:hover,
html.dark .hover\:bg-gray-100:hover {
    background-color: var(--surface-variant) !important;
}
html.dark .card {
    background-color: var(--card-bg);
    border-color: var(--divider);
}
html.dark .sidebar {
    background-color: #18181B;
    border-color: var(--surface-variant);
}
/* 모바일 하단 네비게이션 다크모드 */
html.dark nav.fixed.bottom-0 {
    background-color: var(--card-bg) !important;
    border-color: var(--divider) !important;
}
/* 푸터 다크모드 */
html.dark footer.bg-white {
    background-color: var(--card-bg) !important;
}
/* 입력 필드 다크모드 */
html.dark textarea,
html.dark input[type="text"],
html.dark input[type="email"],
html.dark input[type="password"],
html.dark input[type="tel"],
html.dark input[type="number"],
html.dark input[type="search"] {
    background-color: var(--surface-variant) !important;
    color: var(--text-primary) !important;
    border-color: var(--divider) !important;
}
html.dark textarea::placeholder,
html.dark input::placeholder {
    color: var(--text-hint) !important;
}
/* 버튼 다크모드 */
html.dark .btn-outline {
    background-color: transparent;
    border-color: var(--divider);
    color: var(--text-primary);
}
html.dark .btn-outline:hover {
    background-color: var(--surface-variant);
}
/* Select 다크모드 */
html.dark select {
    background-color: var(--surface-variant) !important;
    color: var(--text-primary) !important;
    border-color: var(--divider) !important;
}
/* 두 컬럼 레이아웃 다크모드 */
html.dark .two-column-list {
    background-color: var(--card-bg);
    border-color: var(--divider);
}
html.dark .two-column-detail {
    background-color: var(--surface);
}
/* 테이블 다크모드 */
html.dark table {
    border-color: var(--divider);
}
html.dark th,
html.dark td {
    border-color: var(--divider) !important;
}
html.dark thead tr {
    background-color: var(--surface-variant) !important;
}
html.dark tbody tr:hover {
    background-color: var(--surface-variant);
}
/* 리스트 아이템 다크모드 */
html.dark li {
    color: var(--text-secondary);
}
/* 필터 칩 다크모드 */
html.dark .filter-chip {
    border-color: var(--divider);
    color: var(--text-secondary);
}
html.dark .filter-chip:hover,
html.dark .filter-chip.active {
    border-color: var(--primary);
    color: var(--primary);
    background-color: rgba(255, 65, 0, 0.1);
}
/* 링크 다크모드 */
html.dark a:not([style*="color"]) {
    color: var(--text-primary);
}
html.dark a:hover {
    color: var(--primary);
}
/* Prose (법적 문서 등) 다크모드 */
html.dark .prose {
    color: var(--text-secondary);
}
html.dark .prose h1,
html.dark .prose h2,
html.dark .prose h3,
html.dark .prose h4,
html.dark .prose h5,
html.dark .prose h6,
html.dark .prose strong {
    color: var(--text-primary);
}
html.dark .prose p,
html.dark .prose li {
    color: var(--text-secondary);
}
/* 정보 박스 (rounded-lg with surface bg) 다크모드 */
html.dark .rounded-lg[style*="background: var(--surface)"] {
    background-color: var(--surface-variant) !important;
}
/* 테두리가 있는 박스 다크모드 */
html.dark .border-l-4 {
    border-color: var(--primary) !important;
}
/* min-h-screen with bg-white 다크모드 */
html.dark .min-h-screen.bg-white {
    background-color: var(--card-bg) !important;
}
/* 법적 문서 sticky 헤더 다크모드 */
html.dark .sticky.top-0.bg-white {
    background-color: var(--card-bg) !important;
    border-color: var(--divider) !important;
}
/* 아바타 영역 다크모드 */
html.dark .avatar {
    background-color: var(--surface-variant);
    color: var(--text-hint);
}
/* 유저 카드 다크모드 */
html.dark .user-card-my {
    background: rgba(255, 65, 0, 0.08);
    border-color: rgba(255, 65, 0, 0.3);
}
body {
    font-family: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
    background-color: var(--surface);
    /* 한국어 개행: 어절 단위 줄바꿈 (index/about 디자인 언어와 동일) */
    word-break: keep-all;
    overflow-wrap: break-word;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: white;
    border-right: 1px solid var(--surface-variant);
    transition: width 0.3s ease;
}
.sidebar-collapsed {
    width: var(--sidebar-collapsed-width);
}
.sidebar-logo {
    color: var(--primary);
    font-weight: 700;
    font-size: 1.5rem;
}
/* Brand logo: wordmark image on the full sidebar, short text on the 72px rail */
.sidebar-logo-img,
.sidebar-logo-img-dark {
    height: 28px;
    width: auto;
    margin-top: 2px;
    display: none;
}
@media (min-width: 1024px) {
    .sidebar-logo-img {
        display: block;
    }
}
/* Dark mode uses the white wordmark (sidebar bg is #18181B) */
html.dark .sidebar-logo-img {
    display: none;
}
@media (min-width: 1024px) {
    html.dark .sidebar-logo-img-dark {
        display: block;
    }
}
/* Tablet rail (md–lg): wordmark hides, show the centered symbol mark
   so the logo box isn't an empty padded gap above the nav. */
.sidebar-logo-symbol {
    height: 32px;
    width: 32px;
    margin: 0 auto;
    display: none;
}
@media (min-width: 768px) and (max-width: 1023px) {
    .sidebar-logo-symbol {
        display: block;
    }
}
.sidebar-nav-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: var(--text-secondary);
    border-radius: 12px;
    margin: 4px 8px;
    transition: all 0.2s;
}
.sidebar-nav-item:hover {
    background: rgba(255, 65, 0, 0.08);
    color: var(--primary);
}
.sidebar-nav-item.active {
    background: rgba(255, 65, 0, 0.12);
    color: var(--primary);
    font-weight: 600;
}
.sidebar-nav-item svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}
.sidebar-nav-item > span {
    margin-left: 12px;
}
/* Tablet (md–lg): collapse to a 72px icon-only rail.
   Labels are hidden in this range and the content offset is 72px,
   so the sidebar must shrink to match — otherwise the 240px bar
   overlaps the list and shows icons floating in empty space. */
@media (min-width: 768px) and (max-width: 1023px) {
    .sidebar {
        width: var(--sidebar-collapsed-width);
    }
    .sidebar-nav-item {
        justify-content: center;
        margin: 4px 8px;
        padding: 12px 0;
    }
    /* Bottom profile/login must fit the 72px rail (no labels, icon-only) */
    .sidebar-footer {
        padding: 8px;
    }
    .sidebar-profile {
        justify-content: center;
        padding: 8px 0;
    }
    .sidebar-login-btn {
        padding-left: 0;
        padding-right: 0;
    }
}

/* Main content */
.main-content {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s ease;
}
.main-content > .content-wrapper {
    flex: 1;
}
@media (max-width: 1023px) {
    .main-content {
        margin-left: var(--sidebar-collapsed-width);
    }
}
@media (max-width: 767px) {
    .main-content {
        margin-left: 0;
        padding-bottom: 64px;
    }
}

/* Button styles */
.btn-primary {
    /* DATALK-161: 그라디언트 끝을 --secondary(라이트 amber/kakao 노랑) 대신
       --primary-dark 로 어둡게 — 흰색 텍스트 대비 개선(datalk amber ~1.9:1,
       kakao 노랑 심각 → primary-dark 로 대체해 흰 텍스트가 밝은 끝단에 얹히는 문제 제거).
       각 스킨의 primary-dark 를 쓰므로 스킨 무관하게 안전.
       주의: brand primary(#FF4100) 자체는 흰 텍스트 ~3.45:1 로 normal-text 4.5 미달 —
       브랜드색 유지상 한계이며 브라우저 대비검증 필요. */
    /* 새 디자인 언어: 플랫 브랜드 오렌지 + 필(pill) 형태 (그라디언트 제거) */
    background: var(--primary);
    color: var(--primary-text-on-bg);
    border-radius: 9999px;
    transition: all 0.2s;
}
.btn-primary:hover {
    background: var(--primary-dark);
}
/* 다크모드에서 btn-primary 텍스트 색상 강제 적용 */
html.dark .btn-primary {
    color: var(--primary-text-on-bg) !important;
}
html.dark .btn-primary svg {
    color: var(--primary-text-on-bg) !important;
    fill: var(--primary-text-on-bg) !important;
    stroke: var(--primary-text-on-bg) !important;
}
/* 라이트모드에서도 btn-primary 텍스트 색상 명시 */
.btn-primary {
    color: var(--primary-text-on-bg) !important;
}
.btn-primary svg {
    color: var(--primary-text-on-bg) !important;
    fill: var(--primary-text-on-bg) !important;
}
.btn-outline {
    border: 1px solid var(--primary);
    color: var(--primary);
    background: white;
    border-radius: 9999px;
}
.btn-outline:hover {
    background: rgba(255, 65, 0, 0.08);
}

/* Filter chips */
.filter-chip {
    border: 1px solid var(--surface-variant);
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.filter-chip:hover, .filter-chip.active {
    border-color: var(--primary);
    color: var(--primary);
    background-color: rgba(255, 65, 0, 0.08);
}

/* Filter bar scroll hide */
.filter-bar-scroll {
    transition: transform 0.3s ease, opacity 0.3s ease;
}
.filter-bar-scroll.hidden-scroll {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}

/* Cards */
.card {
    /* 새 디자인 언어: 8px + 1px line 보더 흰 카드 (섀도 최소화) */
    background: white;
    border-radius: 8px;
    border: 1px solid var(--surface-variant);
    box-shadow: none;
    transition: all 0.2s;
}
.card:hover {
    box-shadow: 0 4px 12px rgba(22, 24, 28, 0.06);
}
.card-interactive {
    cursor: pointer;
}
.card-interactive:hover {
    transform: translateY(-2px);
}

/* Badges */
.badge-new {
    background-color: #FF6B35;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
}
.badge-online {
    width: 10px;
    height: 10px;
    background-color: var(--success);
    border-radius: 50%;
    border: 2px solid white;
}
.unread-badge {
    background: var(--primary);
    color: var(--primary-text-on-bg);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    min-width: 24px;
    text-align: center;
}
.point-badge {
    background: var(--primary);
    color: var(--primary-text-on-bg);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}
/* P 원형 아이콘 */
.point-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1em;
    height: 1em;
    border-radius: 50%;
    background: currentColor;
    font-size: inherit;
    vertical-align: middle;
    margin-left: 4px;
}
.point-icon::after {
    content: 'P';
    font-size: 0.65em;
    font-weight: 700;
    color: white;
}
.point-icon.inverted {
    background: white;
}
.point-icon.inverted::after {
    color: var(--primary);
}
.point-badge .point-icon {
    background: var(--primary-text-on-bg);
}
.point-badge .point-icon::after {
    color: var(--primary);
}
/* point-badge 텍스트 색상 강제 적용 */
.point-badge {
    color: var(--primary-text-on-bg) !important;
}
.point-badge svg {
    color: var(--primary-text-on-bg) !important;
    stroke: var(--primary-text-on-bg) !important;
}
html.dark .point-badge {
    color: var(--primary-text-on-bg) !important;
}
html.dark .point-badge svg {
    color: var(--primary-text-on-bg) !important;
    stroke: var(--primary-text-on-bg) !important;
}

/* Gender colors */
.gender-male { color: var(--male); }
.gender-female { color: var(--female); }

/* Avatar */
.avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--surface-variant);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-hint);
    flex-shrink: 0;
}
.avatar-sm { width: 40px; height: 40px; }
.avatar-lg { width: 64px; height: 64px; }
.avatar-xl { width: 80px; height: 80px; }

/* Skeleton UI */
.skeleton {
    background: linear-gradient(90deg, var(--surface-variant) 25%, #E0E0E0 50%, var(--surface-variant) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}
html.dark .skeleton {
    background: linear-gradient(90deg, #2A2A2A 25%, #3A3A3A 50%, #2A2A2A 75%);
    background-size: 200% 100%;
}
@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}
.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
}
.skeleton-text-sm {
    height: 12px;
}
.skeleton-card {
    padding: 16px;
    background: var(--card-bg);
    border-radius: 12px;
    margin-bottom: 12px;
}

/* 전역 네비게이션 스켈레톤 — 리스트(친구/피드/대화) 탭 이동·필터 재로딩 시
   SSR 응답 대기 동안의 "멈춘 느낌" 제거. 새 페이지 로드 시 함께 교체됨. */
#navLoadingSkeleton {
    position: fixed;
    inset: 0;
    z-index: 25; /* 사이드바(z-40)·하단 네비(z-30)는 위에 유지, 본문만 덮음 */
    display: none;
    background: var(--surface);
    overflow: hidden;
}
#navLoadingSkeleton.show { display: block; }
.nav-skel-header {
    height: 56px;
    border-bottom: 1px solid var(--surface-variant);
    background: var(--card-bg);
}
.nav-skel-list { padding: 16px; }
.nav-skel-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    margin-bottom: 12px;
    background: var(--card-bg);
    border-radius: 12px;
}
.nav-skel-row .skeleton-lines { flex: 1; min-width: 0; }
@media (min-width: 768px) {
    #navLoadingSkeleton { left: var(--sidebar-collapsed-width); }
}
@media (min-width: 1024px) {
    #navLoadingSkeleton { left: var(--sidebar-width); }
}

/* Modal styles */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 50;
    display: none;
    align-items: center;
    justify-content: center;
}
.modal-backdrop.show {
    display: flex;
}
.modal-content {
    background: white;
    border-radius: 14px;
    max-width: 480px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95);
    opacity: 0;
    transition: all 0.2s;
}
html.dark .modal-content {
    background: var(--card-bg);
}
.modal-backdrop.show .modal-content {
    transform: scale(1);
    opacity: 1;
}

/* Bottom sheet for mobile */
.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: 16px 16px 0 0;
    z-index: 50;
    transform: translateY(100%);
    transition: transform 0.3s;
    max-height: 80vh;
    overflow-y: auto;
}
html.dark .bottom-sheet {
    background: var(--card-bg);
}
.bottom-sheet.show {
    transform: translateY(0);
}

/* Page header */
.page-header {
    background: white;
    border-bottom: 1px solid var(--surface-variant);
    padding: 16px 24px;
    position: sticky;
    top: 0;
    z-index: 30;
}
html.dark .page-header {
    background: var(--card-bg);
    border-color: var(--divider);
}
.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Grid layouts */
.user-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}
@media (max-width: 767px) {
    .user-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

/* User card */
.user-card {
    display: flex;
    align-items: flex-start;
    padding: 16px;
    gap: 12px;
}
.user-card-my {
    background: rgba(255, 65, 0, 0.05);
    border: 1px solid rgba(255, 65, 0, 0.2);
}

/* Two column layout */
.two-column {
    display: grid;
    grid-template-columns: 360px 1fr;
    height: calc(100vh - 1px);
}
.two-column-list {
    border-right: 1px solid var(--surface-variant);
    overflow-y: auto;
    background: white;
}
.two-column-detail {
    overflow-y: auto;
    background: var(--surface);
}
@media (max-width: 1023px) {
    .two-column {
        grid-template-columns: 1fr;
    }
    .two-column-detail {
        display: none;
    }
    .two-column-detail.active {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 40;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--surface-variant);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-hint);
}

/* ─────────────────────────────────────────────────────────────
   로그인 모달 스타일 (base.twig {% if not isLoggedIn %} 블록에서 추출)
   셀렉터가 #loginModal 에 스코프되어 있어 로그인 상태에선 매칭 대상이 없음 → 항상 로드해도 무해.
   ───────────────────────────────────────────────────────────── */
/* 로그인 모달 다크모드 */
html.dark #loginModal .modal-content {
    background: var(--card-bg);
}
html.dark #loginModal input[type="tel"],
html.dark #loginModal .code-input {
    background: var(--surface-variant);
    color: var(--text-primary);
}
html.dark #loginModal .flex.border {
    border-color: var(--divider) !important;
}
html.dark #loginModal .flex.border span:first-child {
    background: var(--surface-variant);
    border-color: var(--divider) !important;
}
html.dark #loginModal [style*="background: var(--surface)"] {
    background: var(--surface-variant) !important;
}
html.dark #loginModal .code-input {
    border-color: var(--divider) !important;
}
.code-input:focus {
    outline: none;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(255, 65, 0, 0.1);
}

/* ─────────────────────────────────────────────────────────────
   Toast 스타일 (base.twig 토스트 컨테이너에서 추출)
   ───────────────────────────────────────────────────────────── */
.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    pointer-events: auto;
    animation: toastSlideIn 0.3s ease-out;
    max-width: 90vw;
}
.toast.toast-success {
    background: #00C853;
    color: white;
}
.toast.toast-error {
    background: #FF5252;
    color: white;
}
.toast.toast-info {
    background: var(--card-bg, #fff);
    color: var(--text-primary);
    border: 1px solid var(--surface-variant);
}
.toast.toast-warning {
    background: #FFA000;
    color: white;
}
.toast.toast-hide {
    animation: toastSlideOut 0.3s ease-in forwards;
}
@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(20px);
    }
}
html.dark .toast.toast-info {
    background: var(--card-bg);
    border-color: var(--divider);
}

/* Public legal pages: report / youth */
.legal-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at 100% 0%, rgba(255, 65, 0, 0.11), transparent 28rem),
        linear-gradient(180deg, #fff 0%, var(--surface) 48%, #fff 100%);
    color: var(--text-primary);
}
.legal-topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 58px;
    padding: 0 18px;
    border-bottom: 1px solid rgba(231, 225, 220, 0.86);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
}
.legal-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 999px;
    color: var(--text-secondary);
}
.legal-back:hover {
    background: var(--surface);
    color: var(--text-primary);
}
.legal-shell {
    width: min(960px, calc(100% - 32px));
    margin: 0 auto;
    padding: clamp(34px, 6vw, 64px) 0 clamp(56px, 8vw, 92px);
}
.legal-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
    gap: clamp(24px, 5vw, 48px);
    align-items: end;
    padding-bottom: clamp(28px, 5vw, 48px);
}
.legal-kicker {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    color: var(--primary);
    font-size: 13px;
    font-weight: 800;
}
.legal-kicker::before {
    content: "";
    width: 28px;
    height: 2px;
    background: var(--primary);
}
.legal-hero h1 {
    max-width: 680px;
    font-size: clamp(31px, 5vw, 58px);
    line-height: 1.18;
    letter-spacing: -0.02em;
    font-weight: 800;
    text-wrap: balance;
}
.legal-hero p {
    max-width: 680px;
    margin-top: 18px;
    color: var(--text-secondary);
    font-size: clamp(16px, 2vw, 19px);
    line-height: 1.75;
    font-weight: 500;
    text-wrap: pretty;
}
.legal-contact-card {
    border: 1px solid var(--brand-line);
    border-radius: 12px;
    background: #fff;
    padding: 22px;
}
.legal-contact-card strong,
.legal-contact-card a {
    color: var(--text-primary);
}
.legal-contact-card dl {
    display: grid;
    gap: 13px;
    margin-top: 14px;
}
.legal-contact-card dt {
    color: var(--text-hint);
    font-size: 12px;
    font-weight: 800;
}
.legal-contact-card dd {
    margin-top: 3px;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.55;
    font-weight: 600;
}
.legal-card {
    border: 1px solid var(--brand-line);
    border-radius: 12px;
    background: #fff;
}
.legal-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1px;
    overflow: hidden;
    background: var(--brand-line);
}
.legal-summary-item {
    min-height: 132px;
    padding: 20px;
    background: #fff;
}
.legal-summary-item b {
    display: block;
    margin-bottom: 9px;
    color: var(--text-primary);
    font-size: 16px;
    line-height: 1.35;
}
.legal-summary-item span {
    display: block;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.62;
}
.legal-section {
    margin-top: 18px;
    padding: clamp(22px, 4vw, 32px);
}
.legal-section h2 {
    margin-bottom: 15px;
    color: var(--text-primary);
    font-size: clamp(20px, 2.5vw, 26px);
    line-height: 1.34;
    font-weight: 800;
    text-wrap: balance;
}
.legal-section h3 {
    margin: 22px 0 9px;
    color: var(--text-primary);
    font-size: 16px;
    line-height: 1.45;
    font-weight: 800;
}
.legal-section p,
.legal-section li {
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.78;
    font-weight: 500;
}
.legal-section ul {
    display: grid;
    gap: 8px;
    margin: 10px 0 18px;
    padding-left: 20px;
    list-style: disc;
}
.legal-note {
    margin-top: 18px;
    padding: 16px 18px;
    border: 1px solid rgba(255, 65, 0, 0.24);
    border-radius: 8px;
    background: rgba(255, 65, 0, 0.07);
}
.legal-note p {
    color: #8f2905;
    font-size: 14px;
    font-weight: 700;
}
.legal-process {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin: 14px 0 12px;
}
.legal-step {
    min-height: 92px;
    padding: 14px;
    border-radius: 8px;
    background: var(--surface);
}
.legal-step small {
    display: block;
    margin-bottom: 7px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
}
.legal-step span {
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.45;
    font-weight: 800;
}
.legal-table-wrap {
    overflow-x: auto;
    margin-top: 14px;
    border: 1px solid var(--brand-line);
    border-radius: 8px;
}
.legal-table {
    width: 100%;
    min-width: 620px;
    border-collapse: collapse;
    background: #fff;
}
.legal-table th,
.legal-table td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--brand-line);
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.55;
    text-align: left;
    vertical-align: top;
}
.legal-table th {
    background: var(--surface);
    color: var(--text-primary);
    font-weight: 800;
}
.legal-table tr:last-child td {
    border-bottom: 0;
}
html.dark .legal-page {
    background:
        radial-gradient(circle at 100% 0%, rgba(255, 107, 64, 0.16), transparent 28rem),
        var(--surface);
}
html.dark .legal-topbar {
    border-color: var(--divider);
    background: rgba(24, 24, 27, 0.9);
}
html.dark .legal-card,
html.dark .legal-contact-card,
html.dark .legal-summary-item,
html.dark .legal-table {
    background: var(--card-bg);
    border-color: var(--divider);
}
html.dark .legal-summary,
html.dark .legal-table th,
html.dark .legal-step {
    background: var(--surface-variant);
}
html.dark .legal-table th,
html.dark .legal-table td {
    border-color: var(--divider);
}
html.dark .legal-note {
    border-color: rgba(255, 107, 64, 0.34);
    background: rgba(255, 107, 64, 0.12);
}
html.dark .legal-note p {
    color: #FFB199;
}
@media (max-width: 900px) {
    .legal-hero {
        grid-template-columns: 1fr;
    }
    .legal-summary {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 640px) {
    .legal-topbar {
        min-height: 54px;
        padding: 0 12px;
    }
    .legal-shell {
        width: min(100% - 24px, 960px);
        padding-top: 28px;
    }
    .legal-process {
        grid-template-columns: 1fr 1fr;
    }
}
