/* ===== 기본 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f0f2f5;
  --bg2: #ffffff;
  --bg3: #e4e6eb;
  --border: #d1d5db;
  --text: #1f2937;
  --text2: #6b7280;
  --primary: #3b82f6;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --ai: #7c3aed;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }

/* ===== 로그인 (sg-bi 로그인 페이지와 동일 — Tailwind v4 계산값을 그대로 옮김) ===== */
:root {
  --sparta-red: #fa0030;
  --sparta-red-deep: #850028;
  --sparta-black: #151524;
  --sparta-gray: #d2d5d9;
  --sparta-gray-light: #f5f6f7;
}
.auth-page {
  font-family: ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
  background: var(--sparta-gray-light);
  color: var(--sparta-black);
  min-height: 100dvh;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.auth-main { margin: 0 auto; display: flex; min-height: 100dvh; max-width: 24rem; flex-direction: column; justify-content: center; padding: 2rem 1rem; }
.auth-brand { margin-bottom: 2rem; display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.auth-brand img { width: 14rem; max-width: 100%; height: auto; display: block; }
.auth-brand h1 { font-size: 1.25rem; line-height: 1.75rem; font-weight: 600; margin: 0; }
.auth-form { display: flex; flex-direction: column; gap: .75rem; }
.auth-input { width: 100%; border-radius: .5rem; border: 1px solid var(--sparta-gray); padding: .75rem; font: inherit; font-size: 1rem; line-height: 1.5rem; color: inherit; background: transparent; outline: none; }
.auth-input::placeholder { opacity: 1; color: color-mix(in oklab, currentcolor 50%, transparent); }
.auth-error { font-size: .875rem; line-height: 1.25rem; color: var(--sparta-red-deep); margin: 0; }
.auth-submit { border-radius: .5rem; background: var(--sparta-red); padding: .75rem; font: inherit; font-size: 1rem; line-height: 1.5rem; font-weight: 500; color: #fff; border: none; cursor: pointer; }
.auth-submit:disabled { opacity: .5; }
a.auth-submit { display: block; text-align: center; text-decoration: none; }
.auth-error a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

/* ===== 공개 문의 폼 (/inquiry) — 로그인 화면과 같은 색·입력칸 ===== */
.inquiry-main { margin: 0 auto; max-width: 40rem; padding: 2rem 1rem 3rem; display: flex; flex-direction: column; gap: 1rem; }
.inquiry-top { display: flex; align-items: center; justify-content: space-between; }
.inquiry-logo img { width: 11rem; height: auto; display: block; }
.inquiry-lang { font-size: .875rem; color: color-mix(in oklab, var(--sparta-black) 60%, transparent); text-decoration: underline; text-underline-offset: 2px; }
.inquiry-title { font-size: 1.5rem; line-height: 2rem; font-weight: 700; margin-top: .5rem; }
.inquiry-intro { font-size: .9375rem; color: color-mix(in oklab, var(--sparta-black) 75%, transparent); }
.inquiry-card { background: #fff; border: 1px solid var(--sparta-gray); border-radius: .75rem; padding: 1.25rem; }
.inquiry-card h2 { font-size: 1.125rem; font-weight: 600; margin-bottom: .5rem; }
.inquiry-card h3 { font-size: .9375rem; font-weight: 600; margin: 1rem 0 .25rem; }
.inquiry-card p, .inquiry-card li { font-size: .875rem; line-height: 1.6; }
.inquiry-card ol, .inquiry-card ul { padding-left: 1.25rem; }
.inquiry-label { font-size: .875rem; font-weight: 600; margin-top: .25rem; }
.inquiry-types { border: none; display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; font-size: .9375rem; }
.inquiry-types legend { font-size: .875rem; font-weight: 600; margin-bottom: .5rem; }
.inquiry-types label { display: flex; align-items: center; gap: .375rem; cursor: pointer; }
.inquiry-types input { accent-color: var(--sparta-red); }
.inquiry-body { resize: vertical; min-height: 10rem; }
.inquiry-hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.inquiry-note { font-size: .8125rem; color: color-mix(in oklab, var(--sparta-black) 55%, transparent); }
.inquiry-again { display: inline-block; margin-top: 1rem; text-align: center; }
.inquiry-footer { display: flex; justify-content: space-between; font-size: .8125rem; color: color-mix(in oklab, var(--sparta-black) 55%, transparent); margin-top: .5rem; }
.inquiry-footer a { text-decoration: underline; text-underline-offset: 2px; }

/* ===== 헤더 ===== */
.header { background: var(--bg2); border-bottom: 1px solid var(--border); box-shadow: 0 1px 3px rgba(0,0,0,.08); position: sticky; top: 0; z-index: 100; }
.header-inner { max-width: 1400px; margin: 0 auto; padding: 0 24px; height: 56px; display: flex; align-items: center; justify-content: space-between; }
.header-logo { font-size: 16px; font-weight: 700; display: inline-flex; align-items: center; flex-shrink: 0; }
.header-logo img { height: 40px; width: auto; display: block; }
.header-nav { display: flex; align-items: center; gap: 20px; }
.nav-link { color: var(--text2); font-size: 13px; transition: color .15s; white-space: nowrap; }
.nav-link:hover { color: var(--text); }
.nav-user { color: var(--text2); font-size: 13px; white-space: nowrap; }

/* ===== 메인 ===== */
.main { max-width: 1400px; margin: 0 auto; padding: 28px 24px; }

/* ===== 페이지 헤더 ===== */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; gap: 16px; }
.page-header-left { display: flex; flex-direction: column; gap: 6px; }
.page-header-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.page-title { font-size: 20px; font-weight: 700; }
.page-email { color: var(--text2); font-size: 13px; }
.back-link { color: var(--text2); font-size: 13px; }
.back-link:hover { color: var(--text); }

/* ===== 버튼 ===== */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 6px; border: none; cursor: pointer; font-size: 13px; font-weight: 500; transition: opacity .15s; }
.btn:hover { opacity: .85; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-secondary { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn-warning { background: var(--warning); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ai { background: var(--ai); color: #fff; }
.btn-full { width: 100%; justify-content: center; padding: 12px; font-size: 15px; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-link-danger { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 12px; padding: 0; }
.btn-link-danger:hover { text-decoration: underline; }

/* ===== 폼 ===== */
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text2); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .5px; }
.form-hint { font-weight: 400; text-transform: none; letter-spacing: 0; }
.form-input { width: 100%; background: var(--bg3); border: 1px solid var(--border); border-radius: 6px; padding: 9px 12px; color: var(--text); font-size: 14px; outline: none; }
.form-input:focus { border-color: var(--primary); }
.form-input-color { width: 100%; height: 38px; background: var(--bg3); border: 1px solid var(--border); border-radius: 6px; padding: 4px; cursor: pointer; }
.form-input-sm { width: auto; padding: 4px 8px; font-size: 12px; }
.form-textarea { width: 100%; background: var(--bg3); border: 1px solid var(--border); border-radius: 6px; padding: 9px 12px; color: var(--text); font-size: 14px; outline: none; resize: vertical; font-family: inherit; }
.form-textarea:focus { border-color: var(--primary); }
.icon-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.icon-option { width: 38px; height: 38px; font-size: 20px; display: flex; align-items: center; justify-content: center; background: var(--bg3); border: 2px solid var(--border); border-radius: 8px; cursor: pointer; transition: border-color .15s, transform .15s; }
.icon-option:hover { border-color: var(--text2); transform: scale(1.1); }
.icon-option.selected { border-color: var(--primary); background: var(--bg2); transform: scale(1.1); }

/* ===== 알림 ===== */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 20px; font-size: 14px; }
.alert-success { background: rgba(22,163,74,.1); border: 1px solid rgba(22,163,74,.3); color: #15803d; }
.alert-error { background: rgba(220,38,38,.1); border: 1px solid rgba(220,38,38,.3); color: #dc2626; }

/* ===== 배지 ===== */
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-success { background: rgba(22,163,74,.12); color: #15803d; }
.badge-warning { background: rgba(217,119,6,.12); color: #b45309; }

/* ===== 빈 상태 ===== */
.empty-state { text-align: center; padding: 80px 24px; color: var(--text2); }
.empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state p { margin-bottom: 20px; }

/* ===== 탭 ===== */
/* 탭이 많으면 줄어들지 않고 다음 줄로 넘긴다 (한글은 글자 단위로 줄바꿈돼 세로로 쌓이므로) */
.tabs { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab-item { padding: 10px 20px; font-size: 14px; color: var(--text2); border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; display: flex; align-items: center; gap: 8px; transition: color .15s; white-space: nowrap; }
.tab-item:hover { color: var(--text); }
.tab-item.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-count { background: var(--bg3); padding: 1px 7px; border-radius: 10px; font-size: 11px; }
/* 프로젝트 탭: 개수가 늘어도 여러 줄로 자연스럽게 놓이도록 칩 형태 (아래 상태 탭과도 구분됨) */
.tabs-chip { gap: 6px; border-bottom: none; margin-bottom: 16px; }
.tabs-chip .tab-item { padding: 6px 12px; font-size: 13px; background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; margin-bottom: 0; gap: 6px; }
.tabs-chip .tab-item:hover { border-color: var(--text2); }
.tabs-chip .tab-item.active { border-color: var(--primary); color: var(--primary); font-weight: 600; }
.tabs-chip .tab-count { font-weight: 400; }
/* 전체 티켓: 왼쪽 프로젝트 사이드바 + 오른쪽 티켓 목록 (사이드바는 스크롤해도 따라온다) */
.ticket-board { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; }
.project-side { position: sticky; top: 72px; display: flex; flex-direction: column; gap: 2px; padding: 8px; background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; max-height: calc(100vh - 96px); overflow-y: auto; }
.project-side .tab-item { justify-content: space-between; padding: 8px 10px; font-size: 13px; border-bottom: none; border-radius: 6px; margin-bottom: 0; }
.project-side .tab-item:hover { background: var(--bg); }
.project-side .tab-item.active { background: color-mix(in oklab, var(--primary) 10%, transparent); color: var(--primary); font-weight: 600; }
.project-side .tab-count { font-weight: 400; flex-shrink: 0; }
.project-side-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 900px) {
  /* 1fr 은 내용 최소 폭까지 늘어나 줄바꿈 안 하는 미리보기 때문에 화면 밖으로 밀린다 */
  .ticket-board { grid-template-columns: minmax(0, 1fr); }
  .project-side { position: static; flex-direction: row; flex-wrap: wrap; max-height: none; }
}

/* ===== 티켓 목록 ===== */
.ticket-list { display: flex; flex-direction: column; gap: 1px; }
.ticket-item { background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; padding: 16px; cursor: pointer; transition: border-color .15s; display: flex; align-items: flex-start; gap: 10px; margin-bottom: 6px; }
.ticket-item:hover { border-color: var(--primary); }
.ticket-item.checked { background: #eef4ff; border-color: var(--primary); }
.ticket-item.unread { border-left: 3px solid var(--primary); background: var(--bg3); }
.ticket-item.unread .ticket-name { font-weight: 800; }
.ticket-item.unread .ticket-subject { font-weight: 700; }
.unread-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-right: 6px; vertical-align: middle; flex-shrink: 0; }
.ticket-checkbox { display: flex; align-items: center; padding-top: 2px; flex-shrink: 0; }
.ticket-check { width: 16px; height: 16px; cursor: pointer; accent-color: var(--primary); }
.ticket-item-link { display: block; color: inherit; text-decoration: none; }
.btn-danger { background: #ff3b30; color: #fff; border: none; border-radius: 6px; cursor: pointer; font-weight: 600; }
.btn-danger:hover { background: #d63029; }
.ticket-from { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.ticket-name { font-weight: 600; font-size: 14px; }
.ticket-email { color: var(--text2); font-size: 12px; }
.ticket-subject { font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.ticket-preview { color: var(--text2); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 8px; }
.ticket-meta { display: flex; align-items: center; justify-content: space-between; }
.ticket-date { color: var(--text2); font-size: 11px; }
.ticket-status { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 4px; }
.status-open { background: rgba(217,119,6,.1); color: var(--warning); }
.status-draft { background: rgba(124,58,237,.1); color: var(--ai); }
.status-replied { background: rgba(22,163,74,.1); color: var(--success); }

/* ===== 티켓 상세 레이아웃 ===== */
.ticket-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .ticket-layout { grid-template-columns: 1fr; } }

.ticket-header-info { display: flex; flex-direction: column; gap: 6px; }
.ticket-subject { font-size: 18px; }
.ticket-meta-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ticket-from-info { color: var(--text2); font-size: 13px; }

.section-title { font-size: 12px; font-weight: 700; color: var(--text2); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 12px; margin-top: 20px; display: flex; align-items: center; gap: 8px; }
.section-title:first-child { margin-top: 0; }

.email-box { background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; padding: 16px; }
.email-body { font-family: inherit; font-size: 13px; white-space: pre-wrap; word-break: break-word; color: var(--text); line-height: 1.7; }
.email-body.collapsed { max-height: 5.1em; overflow: hidden; }
.email-toggle { background: none; border: none; color: var(--primary); font-size: 12px; font-weight: 600; cursor: pointer; padding: 0; }
.email-toggle:hover { text-decoration: underline; }

.response-box { background: var(--bg3); border: 1px solid var(--border); border-radius: 8px; padding: 14px; margin-bottom: 8px; border-left: 3px solid var(--primary); }
.response-meta { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 11px; color: var(--text2); }
.response-by { font-weight: 600; }

/* ===== 스레드 메시지 ===== */
.thread-message { border: 1px solid var(--border); border-radius: 8px; padding: 14px; margin-bottom: 10px; }
.thread-message-customer { background: var(--bg2); border-left: 3px solid #f59e0b; }
.thread-message-agent { background: var(--bg3); border-left: 3px solid var(--primary); }
.thread-message-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.thread-message-header .thread-date { margin-left: auto; }
.history-select-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.history-select-label { font-size: 12px; font-weight: 600; color: var(--text2); margin-right: 4px; }
.history-check-label { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text2); cursor: pointer; user-select: none; }
.history-check { cursor: pointer; margin: 0; }
.thread-sender { font-size: 12px; font-weight: 600; }
.thread-sender-customer { color: #b45309; }
.thread-sender-agent { color: var(--primary); }
.thread-date { font-size: 11px; color: var(--text2); }
.thread-count-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--primary); color: #fff; font-size: 11px; font-weight: 700; }
.thread-count-inline { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--primary); color: #fff; font-size: 10px; font-weight: 700; margin-left: 4px; }

.ticket-reply { display: flex; flex-direction: column; }
.draft-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.draft-hint { font-size: 11px; color: var(--text2); }
.pending-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; margin-bottom: 12px; background: #fff7ed; border: 1px solid #fdba74; border-radius: 8px; }
.pending-banner-text { font-size: 13px; font-weight: 600; color: #b45309; }
.send-failed-banner { padding: 10px 14px; margin-bottom: 12px; background: #fef2f2; border: 1px solid #fca5a5; border-radius: 8px; color: #b91c1c; font-size: 13px; font-weight: 600; }
.send-failed-reason { margin-top: 4px; font-size: 12px; font-weight: 500; }
.send-failed-badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 4px; background: #fee2e2; color: #b91c1c; margin-right: 4px; }
.pending-banner-text #pendingCountdown { font-weight: 800; }
.reply-textarea { width: 100%; background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; padding: 14px; color: var(--text); font-size: 13px; resize: vertical; outline: none; font-family: inherit; line-height: 1.7; flex: 1; }
.reply-textarea:focus { border-color: var(--primary); }
.reply-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; gap: 12px; flex-wrap: wrap; }
.reply-to, .reply-from { font-size: 12px; color: var(--text2); }
.lang-badge { font-size: 11px; border-radius: 4px; padding: 1px 7px; border: 1px solid var(--border); color: var(--text2); }
.lang-badge-ok { color: #4caf82; border-color: rgba(76,175,130,0.4); background: rgba(76,175,130,0.1); }
.lang-badge-warn { color: #f0a500; border-color: rgba(240,165,0,0.4); background: rgba(240,165,0,0.1); }
.lang-badge-neutral { color: var(--text2); }
/* ===== 번역 영역 ===== */
.translation-box { background: rgba(79,142,247,0.08); border: 1px solid rgba(79,142,247,0.25); border-radius: 8px; padding: 14px; margin-top: 10px; }
.translation-box-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.translation-hint { font-size: 11px; color: var(--text2); margin-top: 6px; }

/* ===== 프로젝트 관리 테이블 ===== */
.project-table-wrap { background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.table { width: 100%; border-collapse: collapse; }
.table th { padding: 12px 16px; text-align: left; font-size: 11px; font-weight: 700; color: var(--text2); text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--border); }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table-empty { text-align: center; color: var(--text2); padding: 40px !important; }
.project-icon-sm { font-size: 18px; margin-right: 8px; }
.project-name-cell { font-weight: 600; }
.text-muted { color: var(--text2); }
.connect-status { display: flex; align-items: center; gap: 8px; }
.connect-email { font-size: 12px; color: var(--text2); }

/* ===== 모달 ===== */
.modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.6); }
.modal-content { position: relative; background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 28px; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; }
.modal-title { font-size: 16px; font-weight: 700; margin-bottom: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* ===== 답변 템플릿 ===== */
/* 내용 미리보기는 줄바꿈을 살려 세 줄까지만 */
.template-preview { white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-size: 13px; line-height: 1.5; color: var(--text2); }
.template-list { display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow-y: auto; font-size: 13px; color: var(--text2); }
.template-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg2); }
.template-item-text { flex: 1; min-width: 0; }
.template-item-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.template-empty { padding: 24px 0; text-align: center; }
.template-group-title { font-size: 12px; font-weight: 600; color: var(--text2); margin-top: 4px; }

/* ===== 토스트 ===== */
.toast { position: fixed; bottom: 24px; right: 24px; padding: 12px 20px; border-radius: 8px; font-size: 14px; z-index: 300; animation: fadeIn .2s; }
.toast-success { background: var(--success); color: #fff; }
.toast-error { background: var(--danger); color: #fff; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; } }

/* ===== 이메일 HTML 렌더링 ===== */
.email-iframe { width: 100%; border: none; min-height: 100px; }
.email-html-body { display: none; }

/* ===== 첨부파일 ===== */
.attachments-box { background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; padding: 16px; }
.attachment-images { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.attachment-image-item { max-width: 300px; }
.attachment-image-item img { max-width: 100%; max-height: 300px; border-radius: 6px; border: 1px solid var(--border); cursor: pointer; transition: transform .15s; object-fit: contain; display: block; }
.attachment-image-item img:hover { transform: scale(1.02); }
.attachment-image-name { font-size: 11px; color: var(--text2); margin-top: 4px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-files { display: flex; flex-direction: column; gap: 6px; }
.attachment-file-item { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--bg3); border: 1px solid var(--border); border-radius: 6px; transition: border-color .15s; text-decoration: none; color: var(--text); }
.attachment-file-item:hover { border-color: var(--primary); }
.attachment-file-icon { font-size: 16px; flex-shrink: 0; }
.attachment-file-name { font-size: 13px; font-weight: 500; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-file-size { font-size: 11px; color: var(--text2); flex-shrink: 0; }

/* ===== 라벨 ===== */
.label-badge { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.label-filter-bar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.label-filter-pill { display: inline-flex; align-items: center; gap: 4px; padding: 4px 12px; border-radius: 16px; font-size: 12px; color: var(--text2); background: var(--bg2); border: 1px solid var(--border); cursor: pointer; transition: all .15s; }
.label-filter-pill:hover { border-color: var(--text2); color: var(--text); }
.label-filter-pill.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.label-filter-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.label-edit-btn { font-size: 11px !important; padding: 2px 8px !important; opacity: .6; transition: opacity .15s; }
.ticket-item:hover .label-edit-btn { opacity: 1; }
.label-picker { position: absolute; top: 100%; left: 0; z-index: 150; background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; padding: 8px; min-width: 200px; box-shadow: 0 4px 12px rgba(0,0,0,.12); }
.label-picker-item { display: flex; align-items: center; gap: 8px; padding: 4px 6px; cursor: pointer; border-radius: 4px; }
.label-picker-item:hover { background: var(--bg3); }
.label-picker-item input[type="checkbox"] { margin: 0; }

/* ===== 검색 ===== */
.search-bar { position: relative; margin-bottom: 16px; }
.search-bar input { width: 100%; padding: 9px 12px 9px 36px; background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; font-size: 13px; color: var(--text); outline: none; }
.search-bar input:focus { border-color: var(--primary); }
.search-bar input::placeholder { color: var(--text2); }
.search-bar-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text2); font-size: 14px; pointer-events: none; }
.search-result-count { font-size: 12px; color: var(--text2); margin-bottom: 8px; }

/* ===== 페이지네이션 ===== */
.pagination { display: flex; align-items: center; justify-content: center; gap: 4px; margin-top: 20px; }
.pagination-btn { padding: 6px 12px; border: 1px solid var(--border); background: var(--bg2); border-radius: 6px; font-size: 13px; color: var(--text2); cursor: pointer; transition: all .15s; }
.pagination-btn:hover { border-color: var(--primary); color: var(--primary); }
.pagination-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination-btn:disabled { opacity: .4; cursor: not-allowed; }
.pagination-info { font-size: 12px; color: var(--text2); margin: 0 8px; }

/* ===== 섹션 네비게이션 ===== */
.section-nav { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 24px; background: var(--bg2); border-bottom: 1px solid var(--border); }
.section-nav-item { padding: 6px 20px; border-radius: 20px; font-size: 13px; font-weight: 600; color: var(--text2); transition: all .15s; }
.section-nav-item:hover { color: var(--text); background: var(--bg3); }
.section-nav-item.active { background: var(--primary); color: #fff; }

/* ===== 리뷰 ===== */
.review-item { background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; padding: 16px; margin-bottom: 6px; }
.review-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; flex-wrap: wrap; gap: 8px; }
.review-rating { color: #f59e0b; font-size: 13px; letter-spacing: 1px; }
.store-badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.store-google { background: rgba(66,133,244,.12); color: #4285f4; }
.store-apple { background: rgba(0,0,0,.08); color: #333; }
.review-body { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 768px) { .review-body { grid-template-columns: 1fr; } }
.review-section-label { font-size: 11px; font-weight: 700; color: var(--text2); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.review-text { font-size: 13px; line-height: 1.6; color: var(--text); }
.review-original { font-size: 12px; color: var(--text2); margin-top: 6px; font-style: italic; }
.review-content { padding: 12px; background: var(--bg); border-radius: 6px; }
.review-reply-content { padding: 12px; background: rgba(124,58,237,.04); border-radius: 6px; border-left: 3px solid var(--ai); }

/* ===== 로딩 오버레이 ===== */
.loading-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 250; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; color: var(--text); }
.loading-spinner { width: 40px; height: 40px; border: 3px solid var(--border); border-top-color: var(--ai); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 모바일 ===== */
/* 뒤에 선언된 기본 규칙을 이기도록 파일 맨 끝에 둔다 */
@media (max-width: 768px) {
  /* 헤더: 로고 아래에 메뉴를 줄바꿈해 전부 보이게, 목록 공간을 위해 따라오지 않게 */
  .header { position: static; }
  .header-inner { height: auto; flex-wrap: wrap; gap: 4px 16px; padding: 10px 16px 8px; }
  .header-nav { width: 100%; flex-wrap: wrap; gap: 4px 14px; }
  .section-nav { padding: 8px 16px; }
  .main { padding: 16px; }
  .page-header { flex-wrap: wrap; margin-bottom: 12px; }

  /* 필터들은 한 줄 가로 스크롤로 접어 티켓 목록이 먼저 보이게 한다 */
  .ticket-board { gap: 12px; }
  .project-side, .ticket-board .tabs, .label-filter-bar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .project-side .tab-item, .label-filter-pill { flex-shrink: 0; white-space: nowrap; }
  .project-side .tab-item { gap: 6px; }
  .ticket-board .tabs { padding-bottom: 1px; } /* .tab-item 의 margin-bottom: -1px 밑줄이 잘리지 않게 */
  .ticket-board .tab-item { padding-left: 12px; padding-right: 12px; }
  .label-filter-bar { margin-bottom: 12px; }

  /* 티켓 카드: 날짜·상태는 본문 옆이 아니라 아래 줄로 */
  .ticket-item { flex-wrap: wrap; padding: 12px; }
  .ticket-from { flex-wrap: wrap; gap: 4px 8px; }
  .ticket-email { min-width: 0; overflow-wrap: anywhere; }
  .ticket-subject { font-size: 15px; }
  .ticket-item > .ticket-meta { flex-basis: 100%; padding-left: 26px; }
}

/* ===== 감사 로그 (/audit-logs) · 티켓 활동 로그 모달 ===== */
.audit-hint { font-size: 12px; color: var(--text2); }
.audit-filter { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; margin-bottom: 16px; }
.audit-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text2); }
.audit-field .form-input { width: auto; min-width: 140px; padding: 7px 10px; font-size: 13px; }
.audit-field .audit-ticket-input { min-width: 220px; }
.audit-error { background: rgba(220,38,38,.08); color: var(--danger); border-radius: 8px; padding: 10px 14px; font-size: 13px; }
.audit-table-wrap { overflow-x: auto; }
.audit-table { min-width: 1000px; }
.audit-table td { padding: 10px 14px; vertical-align: top; font-size: 13px; }
.audit-nowrap { white-space: nowrap; }
.audit-ip { color: var(--text2); font-size: 12px; }
.audit-detail { max-width: 360px; word-break: break-word; color: var(--text2); font-size: 12px; }
.audit-ticket { max-width: 360px; }
.audit-ticket-link { display: block; color: var(--primary); word-break: break-word; }
.audit-ticket-id { display: block; font-family: ui-monospace, Menlo, monospace; font-size: 11px; color: var(--text2); }
.audit-action { display: inline-flex; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; background: rgba(59,130,246,.12); color: #1d4ed8; }
.audit-action-system { background: var(--bg3); color: var(--text2); }
.audit-action-mcp { background: rgba(124,58,237,.12); color: var(--ai); }
.audit-action-danger { background: rgba(220,38,38,.12); color: var(--danger); }
.audit-more { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.activity-modal-content { max-width: 720px; }
.activity-list { list-style: none; margin: 0; padding: 0; max-height: 60vh; overflow-y: auto; border-top: 1px solid var(--border); }
.activity-item { display: grid; grid-template-columns: 150px 120px 1fr; gap: 10px; padding: 8px 2px; border-bottom: 1px solid var(--border); font-size: 13px; }
.activity-time { color: var(--text2); white-space: nowrap; font-size: 12px; }
.activity-actor { word-break: break-all; }
.activity-detail { display: block; color: var(--text2); font-size: 12px; margin-top: 2px; word-break: break-word; }
.activity-empty { padding: 20px 0; text-align: center; color: var(--text2); font-size: 13px; }
@media (max-width: 640px) {
  .activity-item { grid-template-columns: 1fr; gap: 2px; }
}
