/* ================================================================
   PERFECTWIN — Susskind Legal Tech Philosophy UI
   Richard Susskind: "The End of Lawyers?" · "Access to Justice"
   AI-driven legal services · Online Dispute Resolution
================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  /* ── Core Palette ── */
  --bg-base:      #050c18;
  --bg-dark:      #070e1c;
  --bg-card:      #0c1628;
  --bg-hover:     #111f38;
  --bg-elevated:  #14243f;

  /* ── Borders ── */
  --border:       #1a2e4a;
  --border-soft:  #132139;
  --border-glow:  rgba(37,99,235,0.35);

  /* ── Typography ── */
  --text-primary:   #e8f0f9;   /* 밝은 흰색 계열 — 가독성 향상 */
  --text-secondary: #8ab4d4;   /* 충분한 대비 — 배경 대비 개선 */
  --text-muted:     #4e6e8c;   /* 부드러운 회색-청 */
  --text-white:     #f5faff;   /* 거의 흰색 */

  /* ── Brand Accents ── */
  --blue:    #2563eb;
  --blue-lt: #3b82f6;
  --cyan:    #06b6d4;
  --teal:    #0d9488;
  --indigo:  #6366f1;
  --violet:  #7c3aed;
  --green:   #10b981;
  --amber:   #f59e0b;
  --red:     #ef4444;
  --orange:  #f97316;

  /* ── Semantic ── */
  --fw-color: #3b82f6;
  --mf-color: #6366f1;
  --df-color: #0d9488;
  --gk-color: #06b6d4;
  --manager-color: #f59e0b;
}

/* 전역 box-sizing */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* 페이지 전체 가로 스크롤 완전 차단 */
html {
  font-size: 112%; /* 전체 글씨 크기 +12% 확대 — 모바일 가시성 향상 */
  /* 모바일 당겨서 새로고침(pull-to-refresh) 및 바운스 효과 방지 */
  overscroll-behavior: none;
  overscroll-behavior-y: none;
}
html, body {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  /* iOS Safari 바운스 스크롤로 인한 홈화면 이탈 방지 */
  overscroll-behavior: none;
  -webkit-overflow-scrolling: auto;
  /* 앱처럼 고정 (iOS standalone 모드에서 내용 증발 방지) */
  position: relative;
}

body {
  font-family: 'Inter', 'Noto Sans KR', -apple-system, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: -webkit-fill-available; /* iOS Safari 주소창 포함 전체 높이 */
  line-height: 1.5;
  /* 모바일에서 텍스트 선택으로 인한 오동작 최소화 */
  -webkit-tap-highlight-color: transparent;
}

/* ================================================================
   HEADER
================================================================ */
.header {
  background: linear-gradient(180deg, #060e1e 0%, #08112200 100%),
              linear-gradient(90deg, #050c18 0%, #091425 50%, #050c18 100%);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 var(--border), 0 4px 24px rgba(0,0,0,0.6);
}

.header::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--blue) 30%, var(--cyan) 70%, transparent);
  opacity: 0.4;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-logo {
  width: 58px;
  height: 58px;
  background: linear-gradient(145deg, #0a1628 0%, #0f1f3d 100%);
  border: 2px solid rgba(251,191,36,0.55);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.1rem;
  flex-shrink: 0;
}

.header-title h1 {
  font-size: 1.8rem;
  font-weight: 900;
  background: linear-gradient(130deg, #ffffff 0%, #bae6fd 35%, #22d3ee 68%, #0ea5e9 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.16em;
  filter: drop-shadow(0 0 16px rgba(34,211,238,0.6)) drop-shadow(0 2px 4px rgba(0,0,0,0.5));
  line-height: 1;
}

.header-subtitle {
  font-size: 0.68rem;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
  margin-top: 5px;
  font-weight: 400;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(37,99,235,0.08);
  border: 1px solid rgba(37,99,235,0.2);
  border-radius: 20px;
  padding: 4px 12px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  animation: pulse 2.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px var(--green); }
  50% { opacity: 0.5; box-shadow: 0 0 2px var(--green); }
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ================================================================
   LAYOUT
================================================================ */
.layout {
  display: grid;
  grid-template-columns: 264px 1fr;
  height: calc(100vh - 68px - 104px); /* header 68px + footer 104px */
}

/* ================================================================
   FOOTER
================================================================ */
.site-footer {
  height: 104px;
  background: var(--bg-main);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  flex-shrink: 0;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  width: 100%;
  align-items: center;
}
.footer-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.footer-col-right {
  text-align: right;
  align-items: flex-end;
  justify-content: center;
}
.footer-brand {
  font-size: 0.84rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: 0.04em;
  margin-bottom: 1px;
}
.footer-info {
  font-size: 0.7rem;
  color: var(--blue-lt);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}
.footer-contact {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.footer-contact-item {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}
.footer-contact-item a {
  color: var(--text-muted);
  text-decoration: none;
}
.footer-contact-item a:hover {
  color: var(--blue-lt);
  text-decoration: underline;
}
.footer-copy {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 1.6;
}
.footer-dot {
  opacity: 0.4;
}

/* ================================================================
   HAMBURGER BUTTON (모바일 전용 — 데스크탑에서 숨김)
================================================================ */
.hamburger-btn {
  display: none; /* 데스크탑 숨김 */
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  width: 36px;
  height: 36px;
  padding: 0;
  background: rgba(37,99,235,0.12);
  border: 1px solid rgba(37,99,235,0.35);
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
  margin-right: 8px;
  transition: background 0.15s;
}
.hamburger-btn:active { background: rgba(37,99,235,0.25); }
.hamburger-btn span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}
/* X 모양 (열린 상태) */
.hamburger-btn.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.hamburger-btn.open span:nth-child(2) { opacity: 0; }
.hamburger-btn.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ================================================================
   SIDEBAR OVERLAY (모바일 드로어용 배경 딤)
================================================================ */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 285;
  -webkit-backdrop-filter: blur(1px);
  backdrop-filter: blur(1px);
}
.sidebar-overlay.open { display: block; }

/* 모바일 힌트 가시성 */
.intro-hint-desktop { display: block; }
.intro-hint-mobile  { display: none; }

/* ================================================================
   SIDEBAR
================================================================ */
.sidebar {
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 16px 10px;
}

.sidebar-section { margin-bottom: 22px; }

.sidebar-label {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--blue-lt);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0 8px;
  margin-bottom: 8px;
  opacity: 0.7;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ── Agent Cards ── */
.agent-card {
  border-radius: 8px;
  padding: 9px 10px;
  margin-bottom: 4px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.18s ease;
  display: flex;
  align-items: center;
  gap: 9px;
}

.agent-card:hover {
  background: var(--bg-hover);
  border-color: var(--border-glow);
}

.agent-card.active {
  background: rgba(37,99,235,0.1);
  border-color: rgba(37,99,235,0.4);
}

.agent-card.commander-card {
  background: rgba(245,158,11,0.06);
  border-color: rgba(245,158,11,0.2);
  margin-bottom: 10px;
}

.agent-card.commander-card:hover,
.agent-card.commander-card.active {
  background: rgba(245,158,11,0.1);
  border-color: rgba(245,158,11,0.4);
}

.agent-icon {
  font-size: 1.1rem;
  min-width: 28px;
  text-align: center;
}

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

.agent-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
}

.agent-desc {
  font-size: 0.67rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agent-status {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 5px var(--blue);
  min-width: 5px;
}

/* ── Case List ── */
.case-item {
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 4px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.18s;
}

.case-item:hover { background: var(--bg-hover); border-color: var(--border-glow); }
.case-item.active { background: rgba(37,99,235,0.08); border-color: rgba(37,99,235,0.35); }

.case-name-inner {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.case-number-badge {
  font-size: 0.62rem;
  font-weight: 700;
  font-family: 'Consolas', 'Menlo', monospace;
  color: var(--cyan);
  background: rgba(6,182,212,0.10);
  border: 1px solid rgba(6,182,212,0.25);
  border-radius: 4px;
  padding: 1px 5px;
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.case-name {
  font-size: 0.79rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.case-meta {
  font-size: 0.67rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.divider {
  height: 1px;
  background: var(--border-soft);
  margin: 12px 0;
}

/* ================================================================
   MAIN CONTENT
================================================================ */
.main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-dark);
  position: relative;
}

/* ================================================================
   INTRO SCREEN — 서비스 이용 안내
================================================================ */
#introScreen {
  position: absolute;
  inset: 0;
  z-index: 80;
  background: var(--bg-dark);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  pointer-events: all;
}
#introScreen.hiding {
  animation: introSlideOut 0.7s cubic-bezier(0.4, 0, 0.6, 1) forwards;
}
@keyframes introSlideOut {
  from { transform: translateY(0);    opacity: 1; }
  to   { transform: translateY(-100%); opacity: 0; }
}
.intro-box {
  max-width: 640px;
  width: 90%;
  padding: 44px 44px 36px;
  text-align: center;
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}
.intro-icon {
  font-size: 2.8rem;
  margin-bottom: 10px;
  animation: introLineUp 0.6s ease both;
}
.intro-title {
  font-size: 2.1rem;
  font-weight: 800;
  color: #fbbf24;
  letter-spacing: 0.05em;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid rgba(251,191,36,0.35);
  text-shadow:
    0 0 18px #f59e0b,
    0 0 36px rgba(245,158,11,0.7),
    0 0 70px rgba(245,158,11,0.35);
  animation: introLineUp 0.7s 0.05s ease both;
}
/* ── 줄별 슬라이드업 ── */
.intro-line {
  opacity: 0;
  animation: introLineUp 0.75s ease forwards;
}
@keyframes introLineUp {
  from { transform: translateY(28px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.intro-body {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-secondary);
  line-height: 1.85;
  text-align: center;
  margin-bottom: 20px;
  overflow: hidden;
}
.intro-body p {
  margin-bottom: 4px;
}
.intro-body p:last-child { margin-bottom: 0; }

/* 단락 끝 — 빈 줄 한 칸 효과 */
.intro-para-end {
  margin-bottom: 1em !important;
}
.intro-provider {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--blue-lt);
  margin-bottom: 22px;
  letter-spacing: 0.07em;
}
.intro-hint {
  font-size: 0.74rem;
  color: var(--text-muted);
  font-weight: 500;
  animation: introHintPulse 2.2s ease-in-out infinite;
  text-align: center;
  margin-top: 20px;
  padding: 10px 20px;
  width: 100%;
  box-sizing: border-box;
}
@keyframes introHintPulse {
  0%, 100% { opacity: 0.35; }
  50%       { opacity: 1; }
}

/* ── Tab Navigation ── */
.tab-nav {
  display: flex;
  gap: 2px;
  padding: 10px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  padding: 6px 15px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
  font-family: inherit;
}

.tab-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

.tab-btn.active {
  background: rgba(37,99,235,0.15);
  color: #60a5fa;
  border: 1px solid rgba(37,99,235,0.3);
  font-weight: 600;
}

/* ── Tab Content ── */
.tab-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }
#chatPanel.active { display: flex !important; flex-direction: column; }

/* ================================================================
   DASHBOARD
================================================================ */

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
  opacity: 0;
  transition: opacity 0.2s;
}

.stat-card:hover { border-color: var(--border-glow); }
.stat-card:hover::before { opacity: 1; }

.stat-value {
  font-size: 1.9rem;
  font-weight: 800;
  background: linear-gradient(135deg, #60a5fa, #06b6d4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 4px;
  font-weight: 500;
}

.stat-card.urgent .stat-value {
  background: linear-gradient(135deg, var(--red), var(--orange));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Sections */
.section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 16px;
}

.section-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-white);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.02em;
}

.section-title .title-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 8px var(--blue);
  flex-shrink: 0;
}

/* ================================================================
   STRATEGY MATRIX  (Susskind: AI Legal Team Framework)
================================================================ */
.matrix-container {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: linear-gradient(180deg, #070e1c, #0a1524);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 20px;
  position: relative;
}

/* Top decorative line */
.matrix-container::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--blue) 30%, var(--cyan) 70%, transparent);
}

/* Client / Principal bar */
.matrix-client-bar {
  background: linear-gradient(90deg, rgba(245,158,11,0.06), rgba(37,99,235,0.06));
  border-bottom: 1px solid var(--border);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--amber);
  letter-spacing: 0.04em;
}

.matrix-client-badge {
  background: rgba(245,158,11,0.12);
  border: 1px solid rgba(245,158,11,0.3);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--amber);
}

/* Chief Strategist bar */
.matrix-chief-bar {
  background: rgba(245,158,11,0.04);
  border-bottom: 1px solid var(--border);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}

.matrix-chief-bar:hover { background: rgba(245,158,11,0.08); }

.matrix-chief-node {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--amber);
}

.matrix-chief-badge {
  background: rgba(245,158,11,0.12);
  border: 1px solid rgba(245,158,11,0.3);
  border-radius: 4px;
  padding: 2px 10px;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--amber);
}

/* Tier rows */
.matrix-tier {
  padding: 12px 16px;
  position: relative;
}

.matrix-tier + .matrix-tier {
  border-top: 1px solid var(--border-soft);
}

.matrix-tier-label {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0.75;
}

.tier-attack  .matrix-tier-label { color: var(--fw-color); }
.tier-analysis .matrix-tier-label { color: var(--mf-color); }
.tier-pressure .matrix-tier-label { color: var(--df-color); }
.tier-docs     .matrix-tier-label { color: var(--gk-color); }

.matrix-tier-label::before {
  content: '';
  width: 16px;
  height: 1px;
  display: inline-block;
}
.tier-attack  .matrix-tier-label::before { background: var(--fw-color); }
.tier-analysis .matrix-tier-label::before { background: var(--mf-color); }
.tier-pressure .matrix-tier-label::before { background: var(--df-color); }
.tier-docs     .matrix-tier-label::before { background: var(--gk-color); }

.matrix-tier-agents {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Agent node in matrix */
.matrix-agent {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  flex: 1;
  max-width: 88px;
  min-width: 60px;
}

.matrix-agent-circle {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  border: 1.5px solid transparent;
}

.matrix-agent:hover .matrix-agent-circle {
  transform: translateY(-4px) scale(1.08);
}

.tier-attack .matrix-agent-circle {
  background: rgba(59,130,246,0.15);
  border-color: rgba(59,130,246,0.5);
  box-shadow: 0 2px 10px rgba(59,130,246,0.2);
}
.tier-attack .matrix-agent:hover .matrix-agent-circle {
  background: rgba(59,130,246,0.25);
  box-shadow: 0 6px 20px rgba(59,130,246,0.45);
  border-color: var(--blue-lt);
}

.tier-analysis .matrix-agent-circle {
  background: rgba(99,102,241,0.15);
  border-color: rgba(99,102,241,0.5);
  box-shadow: 0 2px 10px rgba(99,102,241,0.2);
}
.tier-analysis .matrix-agent:hover .matrix-agent-circle {
  background: rgba(99,102,241,0.25);
  box-shadow: 0 6px 20px rgba(99,102,241,0.45);
  border-color: var(--indigo);
}

.tier-pressure .matrix-agent-circle {
  background: rgba(13,148,136,0.15);
  border-color: rgba(13,148,136,0.5);
  box-shadow: 0 2px 10px rgba(13,148,136,0.2);
}
.tier-pressure .matrix-agent:hover .matrix-agent-circle {
  background: rgba(13,148,136,0.25);
  box-shadow: 0 6px 20px rgba(13,148,136,0.45);
  border-color: var(--teal);
}

.tier-docs .matrix-agent-circle {
  background: rgba(6,182,212,0.15);
  border-color: rgba(6,182,212,0.5);
  box-shadow: 0 2px 10px rgba(6,182,212,0.2);
}
.tier-docs .matrix-agent:hover .matrix-agent-circle {
  background: rgba(6,182,212,0.25);
  box-shadow: 0 6px 20px rgba(6,182,212,0.45);
  border-color: var(--cyan);
}

.matrix-agent-name {
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
  line-height: 1.2;
  white-space: nowrap;
}

.matrix-agent-role {
  font-size: 0.52rem;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.tier-attack .matrix-agent-role { background: rgba(59,130,246,0.15); color: #93c5fd; }
.tier-analysis .matrix-agent-role { background: rgba(99,102,241,0.15); color: #a5b4fc; }
.tier-pressure .matrix-agent-role { background: rgba(13,148,136,0.15); color: #5eead4; }
.tier-docs .matrix-agent-role { background: rgba(6,182,212,0.15); color: #67e8f9; }

/* Tier separator */
.matrix-separator {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border) 20%, var(--border) 80%, transparent);
}

/* Kickoff / Start Analysis button */
.matrix-action-area {
  padding: 14px;
  background: rgba(37,99,235,0.03);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
}

.analysis-btn {
  background: linear-gradient(135deg, #1d4ed8, #2563eb, #3b82f6);
  border: 1px solid rgba(59,130,246,0.4);
  border-radius: 8px;
  padding: 12px 36px;
  color: white;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: all 0.2s;
  box-shadow: 0 4px 20px rgba(37,99,235,0.3), inset 0 1px 0 rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: inherit;
  animation: analysisGlow 3s ease-in-out infinite;
}

@keyframes analysisGlow {
  0%, 100% { box-shadow: 0 4px 20px rgba(37,99,235,0.3); }
  50% { box-shadow: 0 4px 30px rgba(37,99,235,0.6), 0 0 50px rgba(6,182,212,0.15); }
}

.analysis-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(37,99,235,0.5);
  background: linear-gradient(135deg, #2563eb, #3b82f6, #60a5fa);
}

.analysis-btn:active { transform: translateY(0); }

/* ================================================================
   DIARY CARDS  (다이어리형 에이전트 카드)
================================================================ */
.diary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 8px;
  padding: 4px 0;
}

.diary-card {
  background: var(--bg-dark);
  border: 1px solid var(--border-soft);
  border-left: 3px solid var(--blue);
  border-radius: 10px;
  padding: 10px 6px;
  cursor: pointer;
  transition: all 0.18s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 5px;
  position: relative;
  overflow: hidden;
  min-height: 80px;
}

.diary-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.02), transparent);
  pointer-events: none;
}

.diary-card:hover {
  background: var(--bg-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.diary-card-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.diary-card-body {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.diary-card-name {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-white);
  white-space: normal;
  word-break: keep-all;
  line-height: 1.3;
  text-align: center;
}

.diary-card-desc {
  display: none;
}

.diary-card-badge {
  display: none;
}

/* ================================================================
   CHAT 2분할 레이아웃
================================================================ */
.chat-split-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  height: calc(100vh - 116px);
  overflow: hidden;
}

.chat-left {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--border);
}

.chat-right {
  overflow-y: auto;
  background: var(--bg-card);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* 브리프 빈 상태 */
.brief-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-muted);
  padding: 40px 20px;
}

/* 브리프 섹션 */
.brief-section {
  background: var(--bg-dark);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  overflow: hidden;
}
.brief-section-header {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 13px;
  background: rgba(37,99,235,0.06);
  border-bottom: 1px solid var(--border-soft);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--blue-lt);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.brief-section-body {
  padding: 12px 13px;
}
.brief-row {
  display: flex;
  gap: 8px;
  font-size: 0.76rem;
  margin-bottom: 7px;
  line-height: 1.5;
}
.brief-row:last-child { margin-bottom: 0; }
.brief-label {
  color: var(--text-muted);
  flex-shrink: 0;
  width: 52px;
}
.brief-value { color: var(--text-primary); word-break: break-all; }
.brief-tag {
  display: inline-block;
  font-size: 0.65rem;
  padding: 2px 7px;
  border-radius: 10px;
  background: rgba(37,99,235,0.12);
  color: var(--blue-lt);
  border: 1px solid rgba(37,99,235,0.25);
  margin: 2px 2px 2px 0;
}
.brief-opinion-item {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: 0.75rem;
  line-height: 1.6;
}
.brief-opinion-item:last-child { border-bottom: none; padding-bottom: 0; }
.brief-opinion-agent {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--blue-lt);
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.brief-opinion-text {
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.brief-opinion-text.expanded {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
}
.brief-more-btn {
  display: inline-block;
  background: none;
  border: none;
  color: var(--blue-lt);
  border-radius: 0;
  padding: 0;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 6px;
  letter-spacing: 0.01em;
  opacity: 0.85;
  transition: opacity 0.15s;
}
.brief-more-btn:hover {
  opacity: 1;
  text-decoration: underline;
}
.brief-more-dots {
  letter-spacing: 0.05em;
}
.brief-more-count {
  margin-left: 3px;
  font-size: 0.65rem;
  opacity: 0.7;
}
.brief-task-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: 0.75rem;
}
.brief-task-item:last-child { border-bottom: none; padding-bottom: 0; }
.brief-task-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
}
.brief-task-title { color: var(--text-primary); flex: 1; line-height: 1.4; }
.brief-task-due { font-size: 0.65rem; color: var(--text-muted); margin-top: 2px; }
.brief-empty-sub {
  text-align: center;
  padding: 12px;
  font-size: 0.73rem;
  color: var(--text-muted);
}
.brief-refresh-btn {
  width: 100%;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.68rem;
  padding: 6px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.brief-refresh-btn:hover { border-color: var(--blue-lt); color: var(--blue-lt); }

/* ================================================================
   CHAT INTERFACE
================================================================ */
.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.chat-agent-icon { font-size: 1.7rem; }
.chat-agent-name { font-size: 1rem; font-weight: 700; }
.chat-agent-desc { font-size: 0.73rem; color: var(--text-secondary); margin-top: 1px; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.message {
  display: flex;
  gap: 10px;
  max-width: 86%;
}

.message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  background: var(--bg-hover);
  border: 1px solid var(--border);
}

.message.user .message-avatar {
  background: rgba(37,99,235,0.2);
  border-color: rgba(37,99,235,0.4);
}

.message-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 15px;
  font-size: 0.875rem;
  line-height: 1.75;
  white-space: pre-wrap;
}

.message.user .message-content {
  background: rgba(37,99,235,0.08);
  border-color: rgba(37,99,235,0.25);
}

.message-time {
  font-size: 0.62rem;
  color: var(--text-muted);
  margin-top: 3px;
}

/* Chat Input */
.chat-input-area {
  padding: 14px 20px;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
}

.input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.chat-textarea {
  flex: 1;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: inherit;
  resize: none;
  outline: none;
  max-height: 150px;
  overflow-y: auto;
  transition: border-color 0.2s;
}

.chat-textarea:focus { border-color: rgba(37,99,235,0.5); }
.chat-textarea::placeholder { color: var(--text-muted); }

/* ── 채팅 하단 버튼 공통 기반 ── */
.send-btn,
.multi-agent-btn,
.add-commit-btn {
  flex: 1;                        /* 3버튼 균등 너비 */
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 46px;                   /* 터치 편의 높이 */
  border-radius: 10px;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s ease;
  border: none;
  color: #fff;
  letter-spacing: 0.01em;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.send-btn:active,
.multi-agent-btn:active,
.add-commit-btn:active {
  transform: scale(0.96);
  box-shadow: none;
}
.send-btn:disabled,
.multi-agent-btn:disabled,
.add-commit-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* 🔍 종합분석 — 청록 계열 */
.multi-agent-btn {
  background: linear-gradient(135deg, #0ea5e9, #06b6d4);
  box-shadow: 0 2px 10px rgba(6,182,212,0.35);
}
.multi-agent-btn:hover { filter: brightness(1.12); transform: translateY(-1px); }

/* 📌 커밋 — 보라 계열 */
.add-commit-btn {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  box-shadow: 0 2px 10px rgba(168,85,247,0.35);
}
.add-commit-btn:hover { filter: brightness(1.12); transform: translateY(-1px); }

/* 전송 — 파랑 계열 */
.send-btn {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  box-shadow: 0 2px 10px rgba(37,99,235,0.35);
}
.send-btn:hover { filter: brightness(1.12); transform: translateY(-1px); }

/* ── 타임라인 (업무 일정 진척사항) ── */
.timeline-body {
  overflow-y: auto;
  max-height: 340px;
  padding: 6px 10px !important;
}
.timeline-item {
  display: flex;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border-soft);
  align-items: flex-start;
}
.timeline-item:last-child { border-bottom: none; }
.timeline-time {
  font-size: 0.62rem;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 70px;
  padding-top: 1px;
  flex-shrink: 0;
}
.timeline-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.timeline-agent {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--blue-lt);
  white-space: nowrap;
}
.timeline-headline {
  font-size: 0.72rem;
  color: var(--text-secondary);
  line-height: 1.45;
  word-break: break-all;
}

/* ── Add Commit 모달 — 태스크 행 ── */
.commit-task-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-dark);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  cursor: pointer;
}
.commit-task-row:hover { border-color: var(--blue-lt); }
.commit-task-row input[type="checkbox"] {
  margin-top: 2px;
  accent-color: var(--blue-lt);
  flex-shrink: 0;
}
.commit-task-info { display: flex; flex-direction: column; gap: 2px; }
.commit-task-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}
.commit-task-meta {
  font-size: 0.66rem;
  color: var(--text-muted);
}

/* ================================================================
   TASKS
================================================================ */
.task-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.task-column {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  min-height: 280px;
}

.column-header {
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-white);
}

.task-item {
  background: var(--bg-dark);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 7px;
  cursor: pointer;
  transition: all 0.18s;
}

.task-item:hover { border-color: var(--border-glow); background: var(--bg-hover); }
.task-title { font-size: 0.8rem; font-weight: 600; margin-bottom: 4px; }
.task-meta { font-size: 0.68rem; color: var(--text-secondary); display: flex; gap: 8px; flex-wrap: wrap; }

.badge {
  font-size: 0.62rem;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
}

.badge-urgent  { background: rgba(239,68,68,0.15);  color: #f87171; }
.badge-high    { background: rgba(249,115,22,0.15); color: #fb923c; }
.badge-normal  { background: rgba(37,99,235,0.15);  color: #60a5fa; }
.badge-low     { background: rgba(100,116,139,0.15); color: #94a3b8; }
.badge-pending  { background: rgba(37,99,235,0.12);  color: #60a5fa; }
.badge-progress { background: rgba(99,102,241,0.15); color: #a5b4fc; }
.badge-done     { background: rgba(16,185,129,0.15); color: #34d399; }

/* ================================================================
   FORMS
================================================================ */
.form-group { margin-bottom: 8px; }

.form-label {
  display: block;
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--blue-lt);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 13px;
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: rgba(37,99,235,0.5);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.08);
}

.form-select option { background: var(--bg-card); }
.form-textarea { resize: vertical; min-height: 60px; }

/* 날짜 input 다크테마 픽스 */
input[type="date"].form-input,
input[type="date"].form-input::-webkit-datetime-edit,
input[type="date"].form-input::-webkit-datetime-edit-fields-wrapper {
  color-scheme: dark;
  color: var(--text-primary);
}
input[type="date"].form-input::-webkit-calendar-picker-indicator {
  filter: invert(0.75) sepia(0.2) hue-rotate(190deg);
  cursor: pointer;
  opacity: 0.85;
}
input[type="date"].form-input::-webkit-datetime-edit-text,
input[type="date"].form-input::-webkit-datetime-edit-month-field,
input[type="date"].form-input::-webkit-datetime-edit-day-field,
input[type="date"].form-input::-webkit-datetime-edit-year-field {
  color: var(--text-primary);
}

/* 사건 유형 체크박스 그리드 */
.case-type-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}
.case-type-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}
.case-type-item:hover {
  border-color: rgba(37,99,235,0.45);
  background: var(--bg-hover);
}
.case-type-item:has(input:checked) {
  border-color: rgba(37,99,235,0.65);
  background: rgba(37,99,235,0.12);
}
.case-type-item input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: #3b82f6;
  cursor: pointer;
  flex-shrink: 0;
}
.case-type-item span {
  font-size: 0.72rem;
  color: var(--text-primary);
  line-height: 1.2;
}

/* ================================================================
   BUTTONS
================================================================ */
.btn {
  padding: 8px 18px;
  border-radius: 8px;
  border: none;
  font-size: 0.855rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.18s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary { background: var(--blue); color: white; }
.btn-primary:hover { background: var(--blue-lt); transform: translateY(-1px); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-glow); }

.btn-gold { background: linear-gradient(135deg, var(--blue), var(--cyan)); color: white; }
.btn-gold:hover { opacity: 0.9; transform: translateY(-1px); }

.btn-danger { background: rgba(239,68,68,0.15); color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
.btn-danger:hover { background: rgba(239,68,68,0.25); }

/* ================================================================
   MODALS
================================================================ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(3,8,20,0.85);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  width: 90%;
  max-width: 560px;
  max-height: 78vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,0.8), 0 0 0 1px rgba(37,99,235,0.12);
}

.modal::before {
  content: '';
  display: block;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--blue) 30%, var(--cyan) 70%, transparent);
  margin: -26px -26px 22px;
  opacity: 0.5;
}

.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-white);
  letter-spacing: 0.02em;
}

/* ── 사건 등록 모달 전용 푸터 ─────────────────────────────────────── */
.case-modal-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border-soft);
  background: rgba(255,255,255,0.015);
  border-radius: 0 0 16px 16px;
  flex-shrink: 0;
  box-sizing: border-box;
  width: 100%;
  overflow: hidden;
}

/* 취소 — 왼쪽 고정 */
.cmf-cancel {
  flex: 0 0 auto;
  height: 36px;
  padding: 0 14px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.18s;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}
.cmf-cancel:hover {
  border-color: rgba(255,255,255,0.25);
  color: var(--text-secondary);
  background: rgba(255,255,255,0.06);
}

/* 이전 — 가변폭 */
.cmf-prev {
  flex: 1;
  height: 36px;
  padding: 0 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.18s;
  font-weight: 500;
  white-space: nowrap;
}
.cmf-prev:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text-primary);
}

/* CSV — 가변폭 */
.cmf-csv {
  flex: 1;
  height: 36px;
  padding: 0 10px;
  background: rgba(16,185,129,0.08);
  border: 1px solid rgba(16,185,129,0.3);
  border-radius: 8px;
  color: #34d399;
  font-size: 0.78rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.18s;
  font-weight: 600;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.cmf-csv:hover {
  background: rgba(16,185,129,0.16);
  border-color: rgba(16,185,129,0.5);
}

/* 다음 — 가변폭, 시안 */
.cmf-next {
  flex: 1.2;
  height: 36px;
  padding: 0 10px;
  background: linear-gradient(135deg, #0891b2, #06b6d4);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.18s;
  box-shadow: 0 2px 10px rgba(6,182,212,0.3);
  white-space: nowrap;
}
.cmf-next:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(6,182,212,0.5);
}

/* 완료 — 가변폭, 녹색 (최종 확정) */
.cmf-submit {
  flex: 1.4;
  height: 36px;
  padding: 0 10px;
  background: linear-gradient(135deg, #059669, #10b981);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.18s;
  box-shadow: 0 2px 10px rgba(16,185,129,0.3);
  white-space: nowrap;
}
.cmf-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(16,185,129,0.5);
}
.cmf-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

/* 저장 — 인디고, 다음(시안)·완료(녹색)와 구분 */
.cmf-save {
  flex: 1.2;
  height: 36px;
  padding: 0 10px;
  background: linear-gradient(135deg, #4f46e5, #818cf8);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.18s;
  box-shadow: 0 2px 10px rgba(99,102,241,0.3);
  white-space: nowrap;
}
.cmf-save:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(99,102,241,0.5);
}
.cmf-save:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

/* 하위 호환 */
.cmf-left, .cmf-center, .cmf-right, .cmf-nav { display: contents; }

.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border-soft);
}

/* ================================================================
   DOCUMENTS
================================================================ */
.doc-content {
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  font-size: 0.875rem;
  line-height: 1.85;
  white-space: pre-wrap;
  max-height: 500px;
  overflow-y: auto;
  font-family: 'Inter', monospace;
}

.doc-card {
  background: var(--bg-dark);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.18s;
}

.doc-card:hover { border-color: var(--border-glow); background: var(--bg-hover); }

/* ================================================================
   MULTI AGENT RESULTS
================================================================ */
.multi-result {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 14px;
  overflow: hidden;
}

.multi-result-header {
  padding: 11px 16px;
  background: rgba(37,99,235,0.05);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 0.855rem;
}

.multi-result-body {
  padding: 14px 16px;
  font-size: 0.875rem;
  line-height: 1.75;
  white-space: pre-wrap;
  max-height: 300px;
  overflow-y: auto;
}

/* Result position tags */
.result-pos-tag {
  display: inline-block;
  font-size: 0.58rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 3px;
  color: white;
  margin-right: 6px;
  letter-spacing: 0.08em;
}

.tag-fw      { background: var(--fw-color); }
.tag-mf      { background: var(--mf-color); }
.tag-df      { background: var(--df-color); }
.tag-gk      { background: var(--gk-color); }
.tag-manager { background: var(--amber); color: #1a1200; }

/* ================================================================
   ALERTS
================================================================ */
.alert {
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.82rem;
  margin-bottom: 12px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.alert-success { background: rgba(16,185,129,0.07); border: 1px solid rgba(16,185,129,0.25); color: #34d399; }
.alert-error   { background: rgba(239,68,68,0.07);  border: 1px solid rgba(239,68,68,0.25);  color: #f87171; }
.alert-info    { background: rgba(37,99,235,0.07);  border: 1px solid rgba(37,99,235,0.25);  color: #60a5fa; }
.alert-warning { background: rgba(245,158,11,0.07); border: 1px solid rgba(245,158,11,0.25); color: #fbbf24; }

/* ================================================================
   LOADING / PROGRESS
================================================================ */
.loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 0.875rem;
  padding: 12px;
}

.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(37,99,235,0.2);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.progress-bar {
  height: 3px;
  background: rgba(37,99,235,0.1);
  border-radius: 2px;
  overflow: hidden;
  margin: 8px 0;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
  border-radius: 2px;
  transition: width 0.3s;
}

/* Progress steps */
.progress-steps { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }

.step-badge {
  font-size: 0.62rem;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.step-badge.done {
  background: rgba(16,185,129,0.1);
  border-color: rgba(16,185,129,0.35);
  color: #34d399;
}

.step-badge.active {
  background: rgba(37,99,235,0.12);
  border-color: rgba(37,99,235,0.4);
  color: #60a5fa;
  animation: pulse 1.5s infinite;
}

/* ================================================================
   PLAYER / AGENT DETAIL MODAL
================================================================ */
.player-detail-modal { max-width: 480px; }

.player-detail-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.player-detail-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.9rem;
  flex-shrink: 0;
  border: 2px solid var(--border-glow);
  background: rgba(37,99,235,0.1);
}

.player-detail-pos {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 4px;
  color: white;
  margin-bottom: 4px;
  letter-spacing: 0.1em;
}

.player-detail-name {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-white);
}

.player-tactical-desc {
  background: rgba(37,99,235,0.05);
  border-left: 3px solid var(--blue);
  border-radius: 0 8px 8px 0;
  padding: 10px 14px;
  font-size: 0.82rem;
  line-height: 1.65;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

/* ================================================================
   ANALYSIS MODAL
================================================================ */
.kickoff-modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(37,99,235,0.07);
  border: 1px solid rgba(37,99,235,0.2);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
}

/* ================================================================
   SIDEBAR POSITION GROUPS
================================================================ */
.sidebar-pos-group { margin-bottom: 4px; }
.sidebar-pos-label {
  font-size: 0.55rem;
  font-weight: 700;
  color: rgba(37,99,235,0.5);
  letter-spacing: 0.14em;
  padding: 3px 10px 2px;
  text-transform: uppercase;
}

/* ================================================================
   POSITION COLOR CLASSES (legacy JS compat)
================================================================ */
.pos-color-fw      { color: var(--fw-color); }
.pos-color-mf      { color: var(--mf-color); }
.pos-color-df      { color: var(--df-color); }
.pos-color-gk      { color: var(--gk-color); }
.pos-color-manager { color: var(--amber); }

.fc-fw { background: rgba(59,130,246,0.18); }
.fc-mf { background: rgba(99,102,241,0.18); }
.fc-df { background: rgba(13,148,136,0.18); }
.fc-gk { background: rgba(6,182,212,0.18); }

/* Agent response formatting */
.agent-response h1, .agent-response h2, .agent-response h3 {
  color: #60a5fa;
  margin: 12px 0 6px;
}
.agent-response ul, .agent-response ol { padding-left: 20px; margin: 6px 0; }
.agent-response strong { color: var(--text-white); }
.agent-response em { color: var(--cyan); }

/* ================================================================
   SCROLLBAR
================================================================ */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(37,99,235,0.25); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(37,99,235,0.45); }

/* ================================================================
   RESPONSIVE — 모바일 (768px 이하)
================================================================ */
@media (max-width: 768px) {

  /* ══ 1. 헤더: fixed 고정 + 2단 구조 ══
     overflow-x:hidden 환경에서 sticky가 iOS에서 무력화되므로 fixed 사용 */
  .header {
    position: fixed;
    top: 0; left: 0; right: 0;
    width: 100%;
    z-index: 200;
    height: auto;
    flex-direction: column;
    align-items: stretch;
    padding: 8px 14px 0;
    gap: 0;
    box-sizing: border-box;
    overflow: hidden;           /* 헤더 자체 가로 overflow 차단 */
  }
  .header-title { padding-bottom: 8px; gap: 10px; }
  .header-logo  { width: 40px; height: 40px; font-size: 1.5rem; border-radius: 10px; }
  .header-title h1 { font-size: 1.25rem; letter-spacing: 0.1em; }
  .header-subtitle { display: none; }

  /* ══ 2. 헤더 메뉴 행: 좌우 스와이프 스크롤 ══ */
  .header-actions {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    gap: 7px;
    padding: 6px 0 10px;
    border-top: 1px solid rgba(26,46,74,0.6);
    scrollbar-width: none;
  }
  .header-actions::-webkit-scrollbar { display: none; }
  .header-actions > * { flex-shrink: 0; white-space: nowrap; }

  /* ══ 3. 레이아웃: fixed 헤더 아래로 밀기 ══ */
  .layout {
    display: block;
    width: 100%;
    max-width: 100vw;
    padding-top: 106px;         /* fixed 헤더 높이(≈106px) 보정 */
    padding-bottom: 56px;       /* fixed 푸터 높이(≈56px) 보정 */
    box-sizing: border-box;
    overflow-x: hidden;
    height: auto;
    min-height: 0;
  }
  /* ── 햄버거 버튼 표시 ── */
  .hamburger-btn { display: flex; }

  /* ── 사이드바: 좌측에서 드로어로 슬라이드 인 ── */
  .sidebar {
    display: block !important;
    position: fixed;
    top: 106px;
    left: 0;
    bottom: 56px;
    width: 75vw;
    max-width: 270px;
    z-index: 300;
    transform: translateX(-100%);
    transition: transform 0.26s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    box-shadow: 4px 0 24px rgba(0,0,0,0.5);
    padding: 16px 10px;
  }
  .sidebar.open { transform: translateX(0); }

  /* ══ 4. 메인 영역: 전체 폭 + 가로 overflow 차단 ══ */
  .main {
    width: 100%;
    max-width: 100vw;
    min-height: auto;           /* 강제 뷰포트 높이 제거 — 푸터가 보이도록 */
    overflow-x: hidden;
    overflow-y: visible;
    position: relative;
    box-sizing: border-box;
  }

  /* ══ 5. 인트로 화면: 헤더·푸터 사이 완전 고정 ══ */
  #introScreen {
    position: fixed;
    top: 106px;
    left: 0; right: 0;
    bottom: 56px;
    width: 100vw;
    overflow: hidden !important;
    -webkit-overflow-scrolling: auto !important;
    overscroll-behavior: none;
    touch-action: none;          /* 터치 스크롤 완전 차단 */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
  }

  /* ══ 6. 인트로 박스: 중앙 정렬 ══ */
  .intro-box {
    width: calc(100vw - 32px);
    max-width: 480px;
    margin: 0 auto 16px;
    flex-shrink: 0;
    padding: 18px 16px 14px;
    box-sizing: border-box;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  }
  .intro-icon    { font-size: 1.5rem; margin-bottom: 4px; }
  .intro-title   { font-size: 1.25rem; white-space: nowrap; letter-spacing: 0.02em; margin-bottom: 10px; padding-bottom: 8px; }
  .intro-body    { font-size: 0.73rem; line-height: 1.52; margin-bottom: 10px; }
  .intro-body p  { margin-bottom: 2px; }
  .intro-para-end { margin-bottom: 0.65em !important; }
  .intro-provider { font-size: 0.72rem; margin-bottom: 8px; }
  .intro-hint     { font-size: 0.62rem; line-height: 1.4; }
  /* 데스크탑 힌트는 숨기고 모바일 힌트 표시 */
  .intro-hint-desktop { display: none; }
  .intro-hint-mobile  {
    display: block;
    font-size: 0.62rem;
    color: var(--blue-lt);
    text-align: center;
    line-height: 1.5;
    padding: 6px 8px;
    background: rgba(37,99,235,0.07);
    border: 1px solid rgba(37,99,235,0.2);
    border-radius: 6px;
    margin-top: 4px;
  }

  /* ══ 7. 탭 콘텐츠: 패딩·가로 overflow 차단 ══ */
  .tab-content {
    padding: 12px;
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
  }

  /* ══ 8. 그리드 조정 ══ */
  .task-grid   { grid-template-columns: 1fr; }
  .stats-grid  { grid-template-columns: repeat(2, 1fr); }

  /* 대시보드 내 인라인 2열·3열 → 1열 */
  .tab-panel [style*="grid-template-columns:1fr 1fr"],
  .tab-panel [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  .tab-panel [style*="grid-template-columns:repeat(3"],
  .tab-panel [style*="grid-template-columns: repeat(3"] {
    grid-template-columns: 1fr !important;
  }

  /* ══ 9. 섹션·카드: 폭 고정 방지 ══ */
  .section {
    width: 100%;
    box-sizing: border-box;
  }

  /* ══ 10. 모달: 화면 폭에 맞게 ══ */
  .modal {
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
    margin: 12px auto;
    box-sizing: border-box;
  }

  /* ══ 11. 채팅 패널 — 모바일 ══ */

  /* 탭 네비게이션 축소 */
  .tab-nav {
    padding: 6px 10px;
    overflow-x: auto;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .tab-btn {
    font-size: 0.72rem;
    padding: 5px 10px;
  }

  /* 채팅 레이아웃 — 단열, 높이 = 화면 - 헤더106 - 탭52 - 푸터56 */
  .chat-split-layout {
    grid-template-columns: 1fr;
    height: calc(100vh - 106px - 52px - 56px);
    min-height: 0;
  }
  .chat-right { display: none; }

  /* 채팅 좌측 — flex 세로 */
  .chat-left {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
  }

  /* 에이전트 헤더 축소 */
  .chat-header {
    flex-shrink: 0;
    padding: 7px 12px;
    min-height: unset;
  }
  .chat-agent-icon { font-size: 1.1rem; }
  .chat-agent-name { font-size: 0.85rem; }
  .chat-agent-desc { display: none; }

  /* 메시지 영역 — 남은 공간 전부 */
  .chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 10px 12px;
  }

  /* 입력 영역 — 항상 보임 */
  .chat-input-area {
    flex-shrink: 0;
    padding: 8px 12px 10px;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
  }

  /* 버튼 균등 크기 */
  .send-btn,
  .multi-agent-btn,
  .add-commit-btn {
    height: 42px;
    font-size: 0.82rem;
    border-radius: 10px;
  }

  /* ══ 12. 푸터 — 항상 하단에 고정 ══ */
  .site-footer {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 190;
    height: auto;
    /* safe-area: 홈 인디케이터 있는 기기 대응 */
    padding: 7px 14px calc(9px + env(safe-area-inset-bottom, 0px));
    background: var(--bg-card);         /* 배경을 불투명 카드 색으로 */
    border-top: 1px solid var(--border);
    box-sizing: border-box;
    /* GPU 레이어 강제 — Android 렌더링 이슈 방지 */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    will-change: transform;
  }
  .footer-grid        { grid-template-columns: 1fr; gap: 1px; }
  .footer-col-right   { display: none; }
  .footer-brand       { font-size: 0.73rem; margin-bottom: 0; }
  .footer-info        { font-size: 0.58rem; gap: 3px; flex-wrap: wrap; }
  .footer-contact     { display: none; }           /* 주소·연락처 행 모두 숨김 */

  /* ══ 채팅 초기 안내 카드 — 모바일 최소화 ══ */
  #chatMessages > div:first-child {
    padding: 14px 10px !important;
  }
  #chatMessages > div:first-child > div:first-child {
    font-size: 1.4rem !important;
    margin-bottom: 4px !important;
  }
  #chatMessages > div:first-child > div:nth-child(2) {
    font-size: 0.82rem !important;
  }
  #chatMessages > div:first-child > div:nth-child(3) {
    font-size: 0.72rem !important;
    margin-top: 3px !important;
  }

  /* ══ 13. 로그인 카드 — 크게·터치 편의 ══ */
  .login-card {
    width: calc(100% - 24px);
    max-width: 100%;
    margin: 12px auto;
    padding: 40px 24px 36px;
    box-sizing: border-box;
  }
  .login-logo     { width: 84px; height: 84px; font-size: 3.6rem; }
  .login-title    { font-size: 1.65rem; margin-bottom: 8px; }
  .login-subtitle { font-size: 0.95rem; font-weight: 600; letter-spacing: 0; margin-bottom: 28px; }
  /* 16px → iOS 자동 확대 방지 */
  .login-input    { font-size: 16px; padding: 14px 16px; border-radius: 12px; }
  .login-label    { font-size: 0.82rem; margin-bottom: 8px; }
  .login-field    { margin-bottom: 18px; }
  .login-btn      { padding: 16px; font-size: 1rem; border-radius: 12px; margin-top: 4px; }
}

/* ================================================================
   CASE FILES — 사건 첨부 파일 관리
================================================================ */

/* 파일 업로드 드롭존 */
.file-upload-zone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: rgba(37,99,235,0.02);
  margin-bottom: 20px;
}

.file-upload-zone:hover,
.file-upload-zone.dragover {
  border-color: var(--cyan);
  background: rgba(6,182,212,0.06);
  box-shadow: 0 0 0 4px rgba(6,182,212,0.08);
}

.file-upload-zone.dragover {
  border-color: var(--blue-lt);
  transform: scale(1.01);
}

.file-upload-zone.uploading {
  pointer-events: none;
  opacity: 0.7;
}

.file-drop-icon {
  font-size: 2.4rem;
  margin-bottom: 10px;
  display: block;
}

.file-drop-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 5px;
}

.file-drop-hint {
  font-size: 0.71rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.file-drop-hint strong {
  color: var(--text-secondary);
}

/* 파일 목록 */
.file-list-header {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.file-item {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 13px 15px;
  margin-bottom: 8px;
  transition: border-color 0.18s;
}

.file-item:hover { border-color: var(--border-glow); }

.file-item-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.file-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  line-height: 1;
}

.file-meta {
  flex: 1;
  min-width: 0;
}

.file-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-info {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 2px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.file-extracted-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.58rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
  letter-spacing: 0.04em;
}

.badge-extracted {
  background: rgba(16,185,129,0.12);
  color: #34d399;
  border: 1px solid rgba(16,185,129,0.25);
}

.badge-no-extract {
  background: rgba(100,116,139,0.12);
  color: #94a3b8;
  border: 1px solid rgba(100,116,139,0.2);
}

/* 파일 텍스트 미리보기 */
.file-preview {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--bg-dark);
  border-radius: 6px;
  border-left: 2px solid var(--border);
  font-size: 0.74rem;
  color: var(--text-secondary);
  line-height: 1.65;
  white-space: pre-wrap;
  max-height: 120px;
  overflow-y: auto;
  display: none;
}

.file-preview.open { display: block; }

.file-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* 파일 카테고리 섹션 */
.file-cat-section {
  margin-bottom: 20px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.02);
}

.file-cat-section .file-list-header {
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-soft);
}

/* 파일 없음 상태 */
.file-empty {
  text-align: center;
  padding: 30px;
  color: var(--text-muted);
}

/* 텍스트 뷰어 모달 */
.file-text-modal { max-width: 680px; }

.file-text-content {
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px;
  font-size: 0.82rem;
  line-height: 1.75;
  white-space: pre-wrap;
  max-height: 55vh;
  overflow-y: auto;
  color: var(--text-primary);
  font-family: 'Inter', monospace;
}

/* ── legacy compat for JS-generated elements ── */
.fc-container { display: none; }

/* 소형 기기 (360px 이하) */
@media (max-width: 360px) {
  .intro-title { font-size: 1.1rem; }
  .intro-box   { padding: 18px 14px 14px; width: calc(100vw - 20px); }
  .login-card  { margin: 8px auto; width: calc(100% - 16px); padding: 32px 18px 28px; }
}

/* ================================================================
   LOGIN SCREEN
================================================================ */
#loginScreen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 30% 20%, #0a1628 0%, #050c18 60%, #02060f 100%);
  backdrop-filter: blur(4px);
}

#loginScreen.hidden {
  display: none;
}

.login-card {
  background: #0c1628;
  border: 1px solid #1a3158;
  border-radius: 20px;
  padding: 48px 44px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow:
    0 0 60px rgba(37,99,235,0.18),
    0 24px 60px rgba(0,0,0,0.55);
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: '';
  position: absolute;
  top: -1px; left: -1px; right: -1px;
  height: 3px;
  background: linear-gradient(90deg, #2563eb, #6366f1, #06b6d4);
  border-radius: 20px 20px 0 0;
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 82px;
  height: 82px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: transparent;
  border: 2px solid rgba(251,191,36,0.4);
  font-size: 3.6rem;
}

.login-title {
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-align: center;
  background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 50%, #34d399 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 6px;
}

.login-subtitle {
  font-size: 1.05rem;
  font-weight: 600;
  color: #4e6e8c;
  text-align: center;
  margin-bottom: 32px;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.login-field {
  margin-bottom: 16px;
}

.login-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: #8ab4d4;
  margin-bottom: 7px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.login-input {
  width: 100%;
  background: #070e1c;
  border: 1px solid #1a3158;
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 0.9rem;
  color: #e8f0f9;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.login-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.18);
}

.login-input::placeholder {
  color: #2e4d6a;
}

.login-btn {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.04em;
  margin-top: 8px;
  transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 4px 20px rgba(37,99,235,0.35);
}

.login-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 6px 28px rgba(37,99,235,0.5);
}

.login-btn:active {
  transform: translateY(0);
}

.login-btn.setup {
  background: linear-gradient(135deg, #7c3aed 0%, #6366f1 100%);
  box-shadow: 0 4px 20px rgba(124,58,237,0.35);
  margin-top: 4px;
}

.login-btn.secondary {
  background: transparent;
  border: 1px solid #1a3158;
  color: #8ab4d4;
  box-shadow: none;
  margin-top: 8px;
  font-weight: 500;
}

.login-btn.secondary:hover {
  background: #111f38;
  box-shadow: none;
}

.login-error {
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.82rem;
  color: #fca5a5;
  margin-bottom: 12px;
  line-height: 1.5;
}

.login-divider {
  text-align: center;
  color: #2e4d6a;
  font-size: 0.75rem;
  margin: 20px 0 4px;
}

.find-link-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  text-decoration: underline dotted;
  transition: color 0.15s;
}
.find-link-btn:hover { color: var(--blue-lt); }

.find-panel {
  margin-top: 16px;
  padding: 18px 16px;
  background: rgba(37,99,235,0.07);
  border: 1px solid rgba(37,99,235,0.2);
  border-radius: 10px;
  animation: slideUp 0.2s ease;
}
.find-panel-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--blue-lt);
  margin-bottom: 14px;
}

/* 찾기 패널 버튼 행 */
.find-panel-row,
.find-panel-btns {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  width: 100%;
}
.find-panel-row .btn-main,
.find-panel-btns .btn-main {
  flex: 1;
  height: 44px;
  background: var(--blue-lt);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
  min-width: 0;
}
.find-panel-row .btn-main:hover,
.find-panel-btns .btn-main:hover { opacity: 0.88; }
.find-panel-row .btn-main:disabled,
.find-panel-btns .btn-main:disabled { opacity: 0.5; cursor: not-allowed; }
.find-panel-row .btn-cancel,
.find-panel-btns .btn-cancel {
  flex: 0 0 60px;
  height: 44px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}
.find-panel-row .btn-cancel:hover,
.find-panel-btns .btn-cancel:hover { background: rgba(255,255,255,0.1); }
.find-result {
  background: rgba(16,185,129,0.1);
  border: 1px solid rgba(16,185,129,0.3);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.82rem;
  color: #6ee7b7;
  margin-bottom: 10px;
  line-height: 1.6;
}

.login-footer {
  text-align: center;
  font-size: 0.7rem;
  color: #2e4d6a;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid #0e1e35;
}

/* 로그인/회원가입 탭 */
.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  border-bottom: 1px solid #1a3158;
}

.auth-tab {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: #4e6e8c;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 10px 0 12px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
  letter-spacing: 0.02em;
  margin-bottom: -1px;
}

.auth-tab.active {
  color: #2563eb;
  border-bottom-color: #2563eb;
}

.auth-tab:hover:not(.active) {
  color: #7da8cc;
}

/* 헤더 사용자 정보 */
#userInfo {
  display: flex;
  align-items: center;
  gap: 10px;
}

#userInfo.hidden {
  display: none;
}

.user-name-badge {
  font-size: 0.8rem;
  color: #8ab4d4;
  background: #0c1628;
  border: 1px solid #1a3158;
  border-radius: 20px;
  padding: 4px 12px;
  font-weight: 500;
}

.logout-btn {
  font-size: 0.78rem;
  color: #4e6e8c;
  background: transparent;
  border: 1px solid #1a2e4a;
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.logout-btn:hover {
  color: #ef4444;
  border-color: rgba(239,68,68,0.4);
}

/* ================================================================
   사건 등록 모달 — 4섹션 탭 스타일
================================================================ */

/* 넓은 모달 */
.case-modal-wide {
  max-width: 720px;
  width: 96vw;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s;
}
.modal-close-btn:hover { background: rgba(255,255,255,0.07); }

/* 탭 헤더 */
.case-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg-dark);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.case-tabs::-webkit-scrollbar { display: none; }

.case-tab {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 11px 6px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  font-family: inherit;
  white-space: nowrap;
}
.case-tab:hover { color: var(--text-primary); }
.case-tab.active {
  color: var(--blue-lt);
  border-bottom-color: var(--blue-lt);
  font-weight: 700;
}

.ct-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--border);
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
}
.case-tab.active .ct-num {
  background: var(--blue-lt);
  color: #fff;
}

/* 탭 바디 */
.case-tab-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px;
  scrollbar-width: none;          /* Firefox */
  -ms-overflow-style: none;       /* IE/Edge */
}
.case-tab-body::-webkit-scrollbar { display: none; } /* Chrome/Safari */

/* CSV 플로팅 패널 (푸터 바로 위) */
#csvFloatPanel {
  border-top: 1px solid rgba(16,185,129,0.25);
  background: rgba(16,185,129,0.06);
  padding: 10px 22px;
  animation: slideUp 0.18s ease;
}
.csv-float-inner {
  max-width: 100%;
}

.case-section { display: none; }
.case-section.active { display: block; }

/* 필수 표시 */
.req { color: #ef4444; margin-left: 2px; }

/* 타임라인 입력 */
.timeline-list { display: flex; flex-direction: column; gap: 8px; }
.timeline-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-tl-del {
  background: none;
  border: 1px solid rgba(239,68,68,0.3);
  color: #ef4444;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.75rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}
.btn-tl-del:hover { background: rgba(239,68,68,0.1); }

/* 증거 카테고리 */
.ev-notice {
  background: rgba(6,182,212,0.08);
  border: 1px solid rgba(6,182,212,0.25);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.78rem;
  color: var(--cyan);
  margin-bottom: 16px;
  line-height: 1.5;
}

.ev-category {
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
}

.ev-cat-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.ev-cat-icon { font-size: 1rem; }
.ev-cat-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
}
.ev-cat-count {
  font-size: 0.7rem;
  color: var(--blue-lt);
  background: rgba(96,165,250,0.1);
  border-radius: 20px;
  padding: 2px 8px;
  font-weight: 700;
}

.ev-upload-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border: 1.5px dashed var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.76rem;
  color: var(--text-muted);
  transition: border-color 0.15s, background 0.15s;
}
.ev-upload-zone:hover, .ev-dragover {
  border-color: var(--blue-lt);
  background: rgba(96,165,250,0.05);
  color: var(--blue-lt);
}
.ev-zone-icon { font-size: 0.9rem; }

.ev-file-list { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }

.ev-file-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(255,255,255,0.03);
  border-radius: 6px;
  font-size: 0.75rem;
}
.ev-file-name { flex: 1; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-file-size { color: var(--text-muted); flex-shrink: 0; }
.btn-ev-del {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}
.btn-ev-del:hover { color: #ef4444; background: rgba(239,68,68,0.1); }

/* 작은 버튼 */
.btn-sm { font-size: 0.75rem; padding: 6px 12px; }

/* ── CSV 변환 도구 ─────────────────────────────────────────────────── */
.csv-tool-panel {
  margin-top: 20px;
  background: rgba(16,185,129,0.06);
  border: 1.5px solid rgba(16,185,129,0.25);
  border-radius: 12px;
  padding: 16px;
}
/* 소형 버전 — 섹션4 상단 고정용 */
.csv-tool-compact {
  margin-top: 0;
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: 8px;
}
.csv-tool-header-row {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.csv-tool-compact .csv-tool-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: #6ee7b7;
}
.csv-tool-compact .csv-tool-desc {
  font-size: 0.68rem;
  color: var(--text-muted);
  flex: 1;
}
.csv-pick-btn-sm {
  width: 100%;
  justify-content: center;
  font-size: 0.76rem;
  padding: 7px 10px;
  border: 1.5px dashed rgba(16,185,129,0.4) !important;
  color: #6ee7b7 !important;
  border-radius: 6px;
}
.csv-pick-btn-sm:hover {
  border-color: #10b981 !important;
  background: rgba(16,185,129,0.08) !important;
}
.csv-selected-info-sm {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.75rem;
}
.csv-tool-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.csv-tool-icon { font-size: 1.4rem; }
.csv-tool-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #6ee7b7;
}
.csv-tool-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 1px;
}
.csv-pick-btn {
  width: 100%;
  justify-content: center;
  font-size: 0.82rem;
  padding: 10px;
  border: 1.5px dashed rgba(16,185,129,0.4) !important;
  color: #6ee7b7 !important;
  border-radius: 8px;
  transition: border-color 0.15s, background 0.15s;
}
.csv-pick-btn:hover {
  border-color: #10b981 !important;
  background: rgba(16,185,129,0.08) !important;
}
.csv-selected-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.78rem;
}
.csv-drop-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border: 1.5px dashed rgba(16,185,129,0.4);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.76rem;
  color: #6ee7b7;
  transition: border-color 0.15s, background 0.15s;
  margin-bottom: 12px;
}
.csv-drop-zone:hover, .csv-drop-zone.ev-dragover {
  border-color: #10b981;
  background: rgba(16,185,129,0.08);
}
.csv-result-row {
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  font-size: 0.76rem;
}
.csv-result-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.csv-file-name {
  flex: 1;
  min-width: 120px;
  color: var(--text-primary);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.csv-size-before { color: var(--text-muted); }
.csv-arrow { color: var(--text-muted); }
.csv-size-after { color: #6ee7b7; font-weight: 700; }
.csv-reduction {
  font-size: 0.7rem;
  padding: 2px 7px;
  border-radius: 20px;
  background: rgba(16,185,129,0.12);
  color: #6ee7b7;
  font-weight: 700;
}
.csv-reduction.neutral {
  background: rgba(148,163,184,0.12);
  color: var(--text-muted);
}
.csv-warn {
  font-size: 0.7rem;
  color: #fbbf24;
  cursor: help;
}
.csv-result-action {
  display: flex;
  align-items: center;
  gap: 8px;
}
.csv-cat-select {
  flex: 1;
  font-size: 0.74rem;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
}
.csv-processing {
  color: var(--text-muted);
  font-size: 0.76rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* 모바일 */
@media (max-width: 600px) {
  .case-modal-wide { max-width: 100%; width: 100%; max-height: 95vh; border-radius: 16px 16px 0 0; }
  .case-tab { font-size: 0.68rem; padding: 10px 4px; }
  .ct-num { display: none; }
  .timeline-row { flex-wrap: wrap; }
  .tl-date { width: 100% !important; }
}

/* ================================================================
   사건 목록 개선 + 자동 킥오프 UI
================================================================ */

/* 사건 목록 — 이름 + 배지 행 */
.case-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 3px;
}

/* 진행 단계 배지 */
.case-stage-badge {
  font-size: 0.6rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  background: rgba(96,165,250,0.15);
  color: var(--blue-lt);
  border: 1px solid rgba(96,165,250,0.3);
  white-space: nowrap;
  flex-shrink: 0;
}

/* 자동 킥오프 배너 */
.auto-kickoff-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, rgba(37,99,235,0.12), rgba(99,102,241,0.08));
  border: 1px solid rgba(96,165,250,0.25);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 18px;
}


/* ================================================================
   플로팅 저장 버튼 — 항상 화면 우측 하단에 표시
================================================================ */
#floatSaveBtn {
  position: fixed;
  bottom: 80px;
  right: 18px;
  z-index: 9999;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 12px 20px;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(37,99,235,0.55);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
  letter-spacing: 0.02em;
}
#floatSaveBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(37,99,235,0.7);
}
#floatSaveBtn:active {
  transform: scale(0.95);
}
#floatSaveBtn.saving {
  opacity: 0.7;
  pointer-events: none;
}

/* ── 사건 삭제 버튼 ── */
.case-delete-btn {
  margin-left: auto;
  flex-shrink: 0;
  padding: 3px 7px;
  font-size: 0.82rem;
  font-family: inherit;
  color: #fca5a5;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  line-height: 1;
}
.case-delete-btn:hover,
.case-delete-btn:active {
  background: rgba(239,68,68,0.3);
  color: #fff;
}
