/* ===== CSS Variables ===== */
:root {
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --primary-light: #818cf8;
  --primary-bg: #eef2ff;
  --secondary: #0ea5e9;
  --success: #10b981;
  --success-bg: #dcfce7;
  --warning: #f59e0b;
  --warning-bg: #fef9c3;
  --danger: #ef4444;
  --danger-bg: #fee2e2;
  --dark: #1e293b;
  --gray-900: #0f172a;
  --gray-800: #1e293b;
  --gray-700: #334155;
  --gray-600: #475569;
  --gray-500: #64748b;
  --gray-400: #94a3b8;
  --gray-300: #cbd5e1;
  --gray-200: #e2e8f0;
  --gray-100: #f1f5f9;
  --gray-50: #f8fafc;
  --white: #ffffff;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --radius-sm: 0.375rem;
  --radius: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --font-sans: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; height: 100%; }
body {
  font-family: var(--font-sans);
  background-color: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
  height: 100%;
  min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: var(--font-sans); }
input, select, textarea { font-family: var(--font-sans); }

/* ===== Layout ===== */
.app-container { display: flex; height: 100vh; overflow: hidden; }

/* ===== Sidebar ===== */
.sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--gray-900);
  color: var(--white);
  display: flex;
  flex-direction: column;
  transition: width 0.3s ease;
  z-index: 100;
  overflow: hidden;
}
.sidebar.collapsed { width: 60px; min-width: 60px; }

.sidebar-header {
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--gray-700);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.sidebar-logo {
  width: 36px; height: 36px;
  background: var(--primary);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.125rem; font-weight: 700; flex-shrink: 0;
}
.sidebar-title {
  font-size: 0.9375rem; font-weight: 700;
  white-space: nowrap; overflow: hidden;
  transition: opacity 0.2s;
}
.sidebar.collapsed .sidebar-title { opacity: 0; width: 0; }

.sidebar-nav { flex: 1; padding: 0.75rem 0; overflow-y: auto; }
.nav-section-label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.5rem 1rem 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity 0.2s;
}
.sidebar.collapsed .nav-section-label { opacity: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1rem;
  color: var(--gray-400);
  transition: all 0.15s;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  border-radius: 0;
}
.nav-item:hover { color: var(--white); background: var(--gray-700); }
.nav-item.active { color: var(--white); background: var(--primary); }
.nav-item .nav-icon { font-size: 1rem; flex-shrink: 0; width: 20px; text-align: center; }
.nav-item .nav-label { overflow: hidden; transition: opacity 0.2s, width 0.2s; }
.sidebar.collapsed .nav-label { opacity: 0; width: 0; }

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--gray-700);
}
.user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  border-radius: var(--radius);
  transition: background 0.15s;
  cursor: pointer;
}
.user-info:hover { background: var(--gray-700); }
.user-avatar {
  width: 32px; height: 32px;
  background: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8125rem; font-weight: 700;
  flex-shrink: 0; color: var(--white);
}
.user-details { overflow: hidden; transition: opacity 0.2s; }
.user-name { font-size: 0.8125rem; font-weight: 600; color: var(--white); white-space: nowrap; }
.user-role { font-size: 0.6875rem; color: var(--gray-400); white-space: nowrap; }
.sidebar.collapsed .user-details { opacity: 0; width: 0; }

/* ===== Main Content ===== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-shrink: 0;
}
.topbar-left { display: flex; align-items: center; gap: 1rem; }
.page-title { font-size: 1.125rem; font-weight: 700; color: var(--gray-900); }
.breadcrumb { font-size: 0.8125rem; color: var(--gray-500); display: flex; gap: 0.25rem; align-items: center; }
.topbar-right { display: flex; align-items: center; gap: 0.75rem; }

/* ===== Page Content ===== */
.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

/* ===== Cards ===== */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
}
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.card-title { font-size: 0.9375rem; font-weight: 700; color: var(--gray-900); }
.card-body { padding: 1.25rem; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid transparent;
  transition: all 0.15s;
  white-space: nowrap;
  line-height: 1.5;
}
.btn:hover { text-decoration: none; }
.btn-sm { padding: 0.3125rem 0.75rem; font-size: 0.8125rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }
.btn-primary { background: var(--primary); color: var(--white); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); border-color: var(--gray-300); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-success { background: var(--success); color: var(--white); border-color: var(--success); }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: var(--white); border-color: var(--danger); }
.btn-danger:hover { background: #dc2626; }
.btn-warning { background: var(--warning); color: var(--white); border-color: var(--warning); }
.btn-outline { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: var(--white); }
.btn-ghost { background: transparent; color: var(--gray-600); border-color: transparent; }
.btn-ghost:hover { background: var(--gray-100); color: var(--gray-900); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== Forms ===== */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: 0.8125rem; font-weight: 600; color: var(--gray-700); margin-bottom: 0.375rem; }
.form-label .required { color: var(--danger); margin-left: 0.25rem; }
.form-control {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: var(--gray-900);
  background: var(--white);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgb(79 70 229 / 0.1);
}
.form-control::placeholder { color: var(--gray-400); }
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  background-size: 1.25rem;
  padding-right: 2.5rem;
}
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.form-hint { font-size: 0.75rem; color: var(--gray-500); margin-top: 0.25rem; }
.form-error { font-size: 0.75rem; color: var(--danger); margin-top: 0.25rem; }

/* ===== Table ===== */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
  white-space: nowrap;
}
.data-table thead tr {
  background: var(--gray-50);
  border-bottom: 2px solid var(--gray-200);
}
.data-table th {
  padding: 0.625rem 0.875rem;
  text-align: left;
  font-weight: 600;
  color: var(--gray-600);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  position: sticky;
  top: 0;
  background: var(--gray-50);
  z-index: 10;
  white-space: nowrap;
}
.data-table td {
  padding: 0.5625rem 0.875rem;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
  vertical-align: middle;
}
.data-table tbody tr:hover { background: var(--gray-50); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* Block row styles */
.data-table tr.block-header { background: #eff6ff; border-top: 2px solid var(--primary-light); }
.data-table tr.block-header td { font-weight: 600; color: var(--gray-900); }
.data-table tr.block-child td { background: var(--white); }
.data-table tr.block-child:hover td { background: var(--gray-50); }
.data-table tr.block-child td:first-child { border-left: 3px solid var(--gray-200); }
.block-indent { padding-left: 1.25rem !important; color: var(--gray-500); }

/* ===== Badges ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.1875rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.4;
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef9c3; color: #854d0e; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-info    { background: #dbeafe; color: #1e40af; }
.badge-gray    { background: var(--gray-100); color: var(--gray-600); }
.badge-purple  { background: #ede9fe; color: #5b21b6; }
.badge-orange  { background: #ffedd5; color: #9a3412; }

/* ===== Spec Card (블럭형 카드) ===== */
.spec-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  margin-bottom: 0.625rem;
  overflow: hidden;
  transition: box-shadow 0.2s, border-color 0.2s;
}
.spec-card:hover { box-shadow: var(--shadow-md); }
.spec-card.expanded {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 2px rgb(79 70 229 / 0.1), var(--shadow-md);
}

/* ── 카드 헤더 (항상 보임) ── */
.spec-card-header {
  display: flex;
  align-items: stretch;
  cursor: pointer;
  user-select: none;
  background: var(--white);
  transition: background 0.1s;
  min-height: 64px;
}
.spec-card-header:hover { background: var(--gray-50); }
.spec-card.expanded .spec-card-header {
  background: linear-gradient(135deg, #eef2ff 0%, #f0fdf4 100%);
  border-bottom: 1px solid #dbeafe;
}

/* 왼쪽 컬러 바 */
.spec-card-bar {
  width: 4px;
  flex-shrink: 0;
  background: var(--gray-200);
  transition: background 0.2s;
}
.spec-card.status-판매중  .spec-card-bar { background: var(--success); }
.spec-card.status-단종    .spec-card-bar { background: var(--danger); }
.spec-card.status-준비중  .spec-card-bar { background: var(--warning); }
.spec-card.status-일시중지 .spec-card-bar { background: var(--gray-400); }
.spec-card.expanded       .spec-card-bar { background: var(--primary); }

/* 토글 아이콘 영역 */
.spec-card-toggle-wrap {
  display: flex;
  align-items: center;
  padding: 0 0.875rem;
  flex-shrink: 0;
}
.spec-card-toggle {
  width: 22px; height: 22px;
  background: var(--gray-100);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.625rem;
  color: var(--gray-500);
  transition: all 0.2s;
  flex-shrink: 0;
}
.spec-card.expanded .spec-card-toggle {
  background: var(--primary);
  color: var(--white);
  transform: rotate(0deg);
}

/* 타이틀 영역 */
.spec-card-title-area {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0.75rem 0.5rem 0.75rem 0;
  min-width: 180px;
  flex-shrink: 0;
}
.spec-card-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}
.spec-card-code {
  font-size: 0.6875rem;
  color: var(--gray-400);
  margin-top: 0.2rem;
}
.spec-card-code code {
  background: var(--gray-100);
  padding: 0.1rem 0.4rem;
  border-radius: 0.25rem;
  font-size: 0.6875rem;
  color: var(--gray-600);
}

/* 구분선 */
.spec-card-divider {
  width: 1px;
  background: var(--gray-200);
  margin: 0.75rem 0.875rem;
  flex-shrink: 0;
}

/* 요약 정보 영역 */
.spec-card-summary {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  flex-wrap: wrap;
  padding: 0.75rem 0;
  min-width: 0;
}

/* 상태 뱃지 */
.spec-card-status { flex-shrink: 0; }

/* 가격 정보 그룹 */
.spec-card-prices {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.price-item {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.price-label {
  font-size: 0.625rem;
  color: var(--gray-400);
  font-weight: 500;
  line-height: 1;
  margin-bottom: 0.1rem;
}
.price-value {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--gray-800);
  white-space: nowrap;
}
.price-value.sale  { color: #1d4ed8; }
.price-value.cost  { color: #7c3aed; }
.price-value.guide { color: var(--gray-500); font-size: 0.75rem; font-weight: 600; }

.price-sep { width: 1px; height: 28px; background: var(--gray-200); flex-shrink: 0; }

/* 주요 부품 칩 */
.spec-card-key-parts {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}
.key-part-chip {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}
.key-part-chip .kp-type {
  color: #93c5fd;
  margin-right: 0.2rem;
}

/* 마켓 미니 뱃지 */
.market-mini-badges {
  display: flex;
  gap: 0.15rem;
  align-items: center;
  flex-shrink: 0;
}
.market-mini-badge {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
  background: var(--gray-100);
  cursor: default;
  transition: transform 0.1s;
}
.market-mini-badge:hover { transform: scale(1.2); }
.market-mini-badge.active { background: #dcfce7; }
.market-mini-badge.count {
  font-size: 0.625rem;
  font-weight: 700;
  color: var(--gray-600);
  background: var(--gray-200);
}

/* 액션 버튼 영역 */
.spec-card-actions {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0 0.875rem;
  flex-shrink: 0;
  border-left: 1px solid var(--gray-100);
}

/* ── 접혔을 때 힌트 바 ── */
.spec-card-hint {
  padding: 0.4rem 1.25rem 0.4rem 4rem;
  font-size: 0.75rem;
  color: var(--gray-400);
  background: var(--gray-50);
  border-top: 1px solid var(--gray-100);
  display: flex;
  gap: 0.625rem;
  flex-wrap: wrap;
  align-items: center;
}
.hint-part {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.hint-part-type { color: var(--gray-500); font-weight: 600; }
.hint-part-name { color: var(--gray-700); }
.hint-sep { color: var(--gray-300); font-size: 1rem; line-height: 1; }

/* ── 카드 바디 (펼쳐진 상태) ── */
.spec-card-body { border-top: 1px solid var(--gray-100); }
.parts-table-wrap { overflow-x: auto; }
.parts-table-wrap .data-table { font-size: 0.8125rem; }
.parts-table-wrap .data-table th {
  background: #f8fafc;
  font-size: 0.6875rem;
  padding: 0.5rem 0.75rem;
}
.parts-table-wrap .data-table td { padding: 0.5rem 0.75rem; }

/* 부품 추가 버튼 영역 */
.card-add-row {
  padding: 0.625rem 1rem;
  border-top: 1px solid var(--gray-100);
  background: var(--gray-50);
}

/* ===== 마켓 패널 (인라인 & 모달) ===== */
.market-panel {
  padding: 1.25rem;
  background: linear-gradient(180deg, #fafbff 0%, var(--white) 100%);
  border-top: 2px solid var(--primary);
}
.market-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.market-panel-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--gray-900);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.market-panel-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* 마켓 그리드 */
.market-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 0.75rem;
}
.market-item {
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 0.875rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.market-item:hover { box-shadow: var(--shadow-sm); }
.market-item.registered {
  border-color: #86efac;
  background: linear-gradient(135deg, #f0fdf4 0%, var(--white) 100%);
}
.market-item.registered.sold-out {
  border-color: #fca5a5;
  background: linear-gradient(135deg, #fef2f2 0%, var(--white) 100%);
}

.market-item-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.625rem;
}
.market-icon {
  width: 32px; height: 32px;
  border-radius: var(--radius);
  background: var(--gray-100);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.market-label { font-size: 0.875rem; font-weight: 700; flex: 1; color: var(--gray-800); }
.market-status-area { flex-shrink: 0; }

.market-toggle-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.toggle-switch {
  position: relative;
  width: 36px; height: 20px;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--gray-300);
  border-radius: 9999px;
  cursor: pointer;
  transition: background 0.2s;
}
.toggle-slider:before {
  content: '';
  position: absolute;
  height: 14px; width: 14px;
  left: 3px; top: 3px;
  background: var(--white);
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.2);
}
.toggle-switch input:checked + .toggle-slider { background: var(--success); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(16px); }
.toggle-switch input:disabled + .toggle-slider { opacity: 0.6; cursor: not-allowed; }
.toggle-label {
  font-size: 0.8125rem;
  color: var(--gray-600);
  font-weight: 500;
  cursor: pointer;
}

.market-url-area {
  margin-top: 0.375rem;
  transition: opacity 0.15s;
}
.market-url-area.disabled { opacity: 0.4; pointer-events: none; }
.market-url-row {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}
.market-url-input {
  flex: 1;
  padding: 0.375rem 0.5rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--gray-800);
  background: var(--white);
  transition: border-color 0.15s;
  min-width: 0;
}
.market-url-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgb(79 70 229 / 0.1);
}
.market-url-btn {
  width: 28px; height: 28px;
  border: 1px solid var(--gray-200);
  background: var(--white);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
  text-decoration: none;
  color: var(--gray-600);
}
.market-url-btn:hover { background: var(--gray-100); border-color: var(--gray-300); }
.market-url-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.market-checked-time {
  font-size: 0.625rem;
  color: var(--gray-400);
  margin-top: 0.3rem;
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

/* ===== 수정 타임라인 ===== */
.timeline { padding: 0; }
.timeline-item {
  display: flex;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--gray-100);
  transition: background 0.1s;
  position: relative;
}
.timeline-item:hover { background: var(--gray-50); }
.timeline-item:last-child { border-bottom: none; }

/* 수직 선 */
.timeline-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: calc(1.5rem + 17px);
  top: calc(1rem + 34px);
  bottom: 0;
  width: 2px;
  background: var(--gray-100);
}

.timeline-dot {
  width: 34px; height: 34px;
  background: var(--gray-100);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.875rem;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.timeline-dot.add    { background: #dcfce7; }
.timeline-dot.edit   { background: #dbeafe; }
.timeline-dot.delete { background: #fee2e2; }
.timeline-dot.market { background: #fef9c3; }

.timeline-content { flex: 1; min-width: 0; }
.timeline-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.3rem;
}
.timeline-action {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--gray-800);
  background: var(--gray-100);
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
}
.timeline-user   { font-size: 0.75rem; color: var(--primary); font-weight: 600; }
.timeline-time   { font-size: 0.75rem; color: var(--gray-400); margin-left: auto; white-space: nowrap; }
.timeline-detail { font-size: 0.8125rem; color: var(--gray-600); line-height: 1.5; }

/* ===== 검색/필터 바 ===== */
.search-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid var(--gray-200);
  background: var(--white);
}
.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.search-input-wrap .search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  pointer-events: none;
  font-size: 0.875rem;
}
.search-input-wrap .form-control { padding-left: 2.25rem; }

/* ===== Pagination ===== */
.pagination {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  justify-content: center;
  padding: 1rem;
}
.page-btn {
  width: 32px; height: 32px;
  border: 1px solid var(--gray-300);
  background: var(--white);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8125rem;
  color: var(--gray-600);
  cursor: pointer;
  transition: all 0.15s;
}
.page-btn:hover { background: var(--gray-100); color: var(--gray-900); }
.page-btn.active { background: var(--primary); color: var(--white); border-color: var(--primary); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgb(0 0 0 / 0.45);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  overflow-y: auto;
  transform: translateY(16px);
  transition: transform 0.2s;
}
.modal-overlay.active .modal { transform: translateY(0); }
.modal-lg  { max-width: 820px; }
.modal-xl  { max-width: 1040px; }
.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--white);
  z-index: 10;
}
.modal-title { font-size: 1rem; font-weight: 700; color: var(--gray-900); }
.modal-close {
  width: 32px; height: 32px;
  background: none; border: none;
  color: var(--gray-500);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.125rem;
  cursor: pointer;
  transition: all 0.15s;
}
.modal-close:hover { background: var(--gray-100); color: var(--gray-900); }
.modal-body { padding: 1.5rem; }
.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  position: sticky;
  bottom: 0;
  background: var(--white);
}

/* ===== Toast ===== */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.125rem;
  background: var(--gray-900);
  color: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  font-size: 0.875rem;
  min-width: 280px;
  max-width: 400px;
  animation: slideInRight 0.3s ease;
}
.toast.toast-success { border-left: 4px solid var(--success); }
.toast.toast-error   { border-left: 4px solid var(--danger);  }
.toast.toast-warning { border-left: 4px solid var(--warning); }
.toast.toast-info    { border-left: 4px solid var(--secondary); }
.toast-icon { font-size: 1.125rem; flex-shrink: 0; }
.toast-message { flex: 1; }
.toast-close { background: none; border: none; color: var(--gray-400); cursor: pointer; font-size: 1rem; padding: 0; }
@keyframes slideInRight { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ===== Stats Grid ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 1.125rem 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  transition: box-shadow 0.15s;
}
.stat-card:hover { box-shadow: var(--shadow-sm); }
.stat-icon {
  width: 42px; height: 42px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.125rem;
  flex-shrink: 0;
}
.stat-icon.blue   { background: #dbeafe; color: #2563eb; }
.stat-icon.green  { background: #dcfce7; color: #16a34a; }
.stat-icon.yellow { background: #fef9c3; color: #ca8a04; }
.stat-icon.red    { background: #fee2e2; color: #dc2626; }
.stat-icon.purple { background: #ede9fe; color: #7c3aed; }
.stat-label { font-size: 0.75rem; color: var(--gray-500); font-weight: 500; }
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--gray-900); line-height: 1.2; }
.stat-desc  { font-size: 0.75rem; color: var(--gray-500); margin-top: 0.125rem; }

/* ===== Loading ===== */
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.spinner-sm { width: 18px; height: 18px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { margin-top: 0.75rem; font-size: 0.875rem; color: var(--gray-600); }

/* ===== Empty State ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
}
.empty-icon  { font-size: 3rem; margin-bottom: 1rem; opacity: 0.4; }
.empty-title { font-size: 1.125rem; font-weight: 600; color: var(--gray-700); margin-bottom: 0.5rem; }
.empty-desc  { font-size: 0.875rem; color: var(--gray-500); max-width: 320px; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 9999px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ===== Utility ===== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.text-sm   { font-size: 0.875rem; }
.text-xs   { font-size: 0.75rem; }
.text-muted   { color: var(--gray-500); }
.font-bold    { font-weight: 700; }
.font-semibold{ font-weight: 600; }
.w-full   { width: 100%; }
.relative { position: relative; }
.hidden   { display: none !important; }
.text-right  { text-align: right; }
.text-center { text-align: center; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== Settings / Info Blocks ===== */
.info-block {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}
.info-block.info  { border-color: #93c5fd; background: #eff6ff; }
.info-block.warn  { border-color: #fde047; background: #fefce8; }
.info-block.success { border-color: #86efac; background: #f0fdf4; }

/* ===== Dropzone ===== */
.dropzone {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--gray-50);
}
.dropzone:hover {
  border-color: var(--primary-light);
  background: var(--primary-bg);
}
.dropzone.dragover {
  border-color: var(--primary);
  background: var(--primary-bg);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.15);
}
.dropzone.has-file {
  border-color: var(--success);
  background: var(--success-bg);
  border-style: solid;
}
.dropzone-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}
.dropzone-text {
  font-size: 0.9375rem;
  color: var(--gray-700);
  margin-bottom: 0.25rem;
}
.dropzone-hint {
  font-size: 0.75rem;
  color: var(--gray-500);
}

.config-saved-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  background: var(--success-bg);
  border: 1px solid #86efac;
  border-radius: var(--radius-lg);
  margin-bottom: 1rem;
}
.config-saved-row .saved-icon { font-size: 1.375rem; flex-shrink: 0; }
.config-saved-row .saved-text { flex: 1; font-size: 0.875rem; font-weight: 600; color: #166534; }
.config-saved-row .saved-sub  { font-size: 0.75rem; color: #166534; opacity: 0.75; margin-top: 0.1rem; }

/* ===== Account Table ===== */
.account-table-wrap { overflow-x: auto; }
.account-table th { white-space: nowrap; }
.account-role-badge.admin   { background: #ede9fe; color: #5b21b6; }
.account-role-badge.editor  { background: #dbeafe; color: #1e40af; }
.account-role-badge.viewer  { background: var(--gray-100); color: var(--gray-600); }
.account-status-active   { color: var(--success); font-weight: 600; }
.account-status-inactive { color: var(--danger);  font-weight: 600; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .sidebar { position: fixed; left: -240px; height: 100vh; transition: left 0.3s; }
  .sidebar.mobile-open { left: 0; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
  .page-content { padding: 1rem; }
  .spec-card-title { max-width: 140px; font-size: 0.875rem; }
  .spec-card-prices { display: none; }
  .spec-card-key-parts { display: none; }
  .market-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .market-grid { grid-template-columns: 1fr; }
  .spec-card-summary { gap: 0.375rem; }
}
