:root {
  color-scheme: light;
  /* ── Warm Latte 팔레트 ─────────────────────────────── */
  --bg:            #faf8f5;
  --surface:       #ffffff;
  --surface-muted: #f5f1eb;
  --text:          #292524;
  --text-muted:    #78716c;
  --border:        #e7e2db;
  --primary:       #a16207;
  --primary-soft:  #fef3c7;
  --primary-hover: #92400e;
  --accent:        #c2710c;   /* 매출 추이 차트 매출선 색상 */
  --accent-cost:   #e8895a;   /* 매출 추이 차트 원가선 색상 */
  /* 상태 색상 */
  --status-info:    #dbeafe;
  --status-success: #dcfce7;
  --status-warning: #fef9c3;
  --status-error:   #fee2e2;
  /* 기능 색상 */
  --color-success: #15803d;
  --color-warning: #b45309;
  --color-error:   #dc2626;
  --color-info:    #2563eb;
  /* 헤더 높이: sticky 탭 offset 계산용 */
  --header-height: 57px;

  /* ── 크기 체계 ────────────────────────────────────── */
  /* 폰트: xs(12) / sm(13) / base(14) */
  --fs-xs:   0.75rem;     /* 12px — 뱃지, 마이크로 레이블 */
  --fs-sm:   0.8125rem;   /* 13px — 보조 텍스트, 컴팩트 버튼 */
  --fs-base: 0.875rem;    /* 14px — 기본 텍스트, 표준 버튼·입력 */
  --fs-md:   1rem;        /* 16px — 섹션 헤딩 */

  /* 버튼 높이: sm(28) / md(34) / lg(38) */
  --btn-h-sm: 28px;   /* 인라인 컴팩트 (카드 액션, 뱃지형) */
  --btn-h-md: 34px;   /* 표준 (필터, 메모, 수정) */
  --btn-h-lg: 38px;   /* 주요 액션 (모달 저장, 업로드) */

  /* 공통 반경·입력 높이 */
  --btn-radius:   7px;
  --input-h:      34px;
  --input-radius: 7px;
}

* {
  box-sizing: border-box;
}

/* 전역 버튼·입력 폰트 통일 */
button, input, select, textarea {
  font-family: inherit;
  font-size: var(--fs-base);
}

.hidden {
  display: none !important;
}

html {
  height: 100%;
}

body {
  margin: 0;
  font-family: "Pretendard", "Noto Sans KR", "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  /* 전체 스크롤 제거: 헤더 고정 + 콘텐츠 영역만 스크롤 */
  height: 100%;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.app-shell {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 1px 0 var(--border);
  flex-shrink: 0;
  z-index: 20;
  transition: padding 0.2s ease;
}

.top-nav.compact {
  padding: 6px 16px;
  gap: 8px;
}

.top-nav.compact .brand { font-size: 15px; }
.top-nav.compact .admin-tab { padding: 5px 12px; font-size: 12px; }

.brand {
  font-size: 18px;
  font-weight: 800;
  color: var(--primary-hover);
  letter-spacing: -0.01em;
  flex-shrink: 0;
}

/* 헤더 내 탭 영역: 남는 공간 차지, 횡스크롤 */
.admin-tabs-wrap {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  align-items: center;
}

.admin-tabs-wrap .admin-tabs {
  border: none;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
}

.nav-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
}

.nav-user-info { flex-shrink: 0; }

/* PC: 로그아웃은 텍스트만, 모바일에서 아이콘으로 전환 */
.nav-logout-icon {
  display: none;
}

.nav-logout-btn .nav-logout-icon svg {
  display: block;
  vertical-align: middle;
}

/* 모바일 전용: 페이지/탭 콤보 (PC에서는 숨김) */
.header-mobile-controls {
  display: none;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.header-mobile-controls .nav-mobile-select,
.header-mobile-controls .admin-tabs-mobile-select {
  flex: 1;
  min-width: 0;
  max-width: 50%;
  padding: 6px 10px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.nav-link {
  display: inline-block;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  background: var(--surface-muted);
  font-size: 14px;
}

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

.nav-link.active {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-soft);
  font-weight: 600;
}

.page-content {
  flex: 1;
  min-height: 0;
  /* 헤더 아래 이 영역만 스크롤 → body 레벨 스크롤바 사라짐 */
  overflow-y: auto;
  /* 내부 레이아웃은 flex column */
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 980px;
  width: 100%;
  margin: 0 auto;
  padding: 24px;
  box-sizing: border-box;
}

.page-header {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.page-header h1 {
  margin: 0 0 8px;
  font-size: 28px;
}

.page-header p {
  margin: 0;
  color: var(--text-muted);
}

.placeholder-card {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 1px 4px rgba(120, 83, 30, 0.06);
}

.placeholder-card h2 {
  margin: 0 0 12px;
  font-size: 20px;
}

/* ── 공통 필터 바 (매출·메뉴 탭) ──────────────────────────────────────────── */

.admin-filter-bar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 0 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.admin-filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.admin-filter-label {
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.admin-filter-input {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.85rem;
  background: var(--surface-muted, #f8fafc);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}

.admin-filter-input:focus {
  border-color: var(--primary);
  background: var(--surface);
}

.admin-filter-btn {
  padding: 0 18px;
  min-height: var(--btn-h-lg);
  border-radius: var(--btn-radius);
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: var(--fs-base);
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
  white-space: nowrap;
  align-self: flex-end;
  display: inline-flex;
  align-items: center;
}

.admin-filter-btn:hover {
  opacity: 0.85;
}

.admin-filter-btn--secondary {
  background: var(--surface-muted, #f8fafc);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.admin-filter-btn--secondary:hover {
  opacity: 1;
  background: var(--border);
}

.placeholder-card ul {
  margin: 0;
  padding-left: 20px;
  color: var(--text-muted);
}

.guide-steps {
  margin: 0 0 12px;
  padding-left: 22px;
  color: var(--text);
}

.guide-steps li {
  margin-bottom: 10px;
}

.guide-steps p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 14px;
}

/* ─── 포스 파일 다운로드 가이드 ─────────────────────────────────────────── */

.upload-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}
.upload-section-header h2 { margin: 0; }

.pos-site-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  padding: 7px 16px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s;
  white-space: nowrap;
}
.pos-site-link:hover { background: var(--primary-hover); }

/* 영업일 + 매장 선택 */
.upload-meta-row {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
}
/* 업로드 본문 2열 그리드 */
.upload-body-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: stretch;
  margin-bottom: 0;
}
.upload-right-col {
  display: flex;
  flex-direction: column;
}
/* 드래그존이 가이드 높이에 맞게 늘어남 */
.drop-zone-stretch {
  flex: 1;
  min-height: 200px;
}
.upload-meta-label {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-muted);
}
.upload-meta-input {
  height: var(--input-h);
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--input-radius);
  font-size: var(--fs-base);
  background: var(--surface-muted);
  color: var(--text);
  width: 100%;
}
.upload-meta-input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
}
.upload-meta-input:disabled {
  background: var(--surface-muted);
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.8;
}
@media (max-width: 760px) {
  .upload-body-grid { grid-template-columns: 1fr; }
  .upload-meta-row  { flex-direction: column; }
}

.pos-guide-card {
  background: #fffbf0;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 0;
}

.pos-guide-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary-hover);
  margin-bottom: 14px;
}

.pos-guide-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pos-guide-steps li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.pos-guide-num {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.pos-guide-steps strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 3px;
}

.pos-guide-steps p {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.pos-guide-steps em {
  font-style: normal;
  color: var(--primary-hover);
  font-weight: 600;
}

.pos-guide-steps code {
  background: var(--primary-soft);
  color: var(--primary-hover);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 13px;
  font-weight: 600;
}

/* 가이드 3번 플로우 시각화 */
.pos-guide-step3 { align-items: flex-start; }
.step3-num { background: #f59e0b !important; }

.step3-body { flex: 1; }
.step3-body > strong { display: block; font-size: 14px; font-weight: 700; margin-bottom: 10px; }

.step3-flow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.step3-flow-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  min-width: 72px;
}

.step3-flow-label {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.3;
}

.step3-flow-sub {
  font-size: 11px;
  color: var(--primary-hover);
  font-weight: 600;
  text-align: center;
}

.step3-arrow {
  font-size: 16px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.step3-btn-mock {
  display: inline-block;
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 700;
  border: none;
  cursor: default;
}
.step3-btn-mock.btn-gray {
  background: #e5e7eb;
  color: #374151;
}
.step3-btn-mock.btn-blue {
  background: var(--primary);
  color: #fff;
}

.step3-flow-item-wide { min-width: 90px; }

.step3-note {
  margin: 10px 0 0;
  padding: 8px 12px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  font-size: 12px;
  color: #92400e;
  line-height: 1.5;
}

/* ─── 판매 분석 결과 요약 레이아웃 ────────────────────────────────────────── */

.result-summary-wrap {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  margin-bottom: 16px;
  align-items: stretch;
}

/* 총 매출금액 대표 카드 */
.result-featured-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  background: var(--primary-soft);
  border: 2px solid var(--primary);
  border-radius: 12px;
  padding: 16px 22px;
  min-width: 160px;
}
.rfc-label {
  font-size: 13px;
  color: var(--primary);
  font-weight: 600;
}
.rfc-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--primary);
  white-space: nowrap;
}
.rfc-sub {
  font-size: 12px;
  color: var(--text-muted);
}

/* 우측 2×2 카드 그리드 */
.result-info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 8px;
}

.result-info-card {
  border: 1px solid var(--border);
  background: var(--surface-muted);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.result-info-card span {
  font-size: 12px;
  color: var(--text-muted);
}
.result-info-card strong {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

/* 손실 카드 색상 */
.result-info-card.result-loss-card { border: 1px solid #e5e7eb; }
.result-info-card.result-loss-card.loss-ok   { background: #f0fdf4; border-color: #86efac; }
.result-info-card.result-loss-card.loss-ok span   { color: #166534; }
.result-info-card.result-loss-card.loss-ok strong { color: #16a34a; }
.result-info-card.result-loss-card.loss-mid  { background: #fef9c3; border-color: #fde68a; }
.result-info-card.result-loss-card.loss-mid span   { color: #92400e; }
.result-info-card.result-loss-card.loss-mid strong { color: #d97706; }
.result-info-card.result-loss-card.loss-high { background: #fee2e2; border-color: #fca5a5; }
.result-info-card.result-loss-card.loss-high span   { color: #991b1b; }
.result-info-card.result-loss-card.loss-high strong { color: #dc2626; }

/* 카드 목록 툴바 */
.result-card-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.result-card-toolbar-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.toolbar-btn {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 14px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.toolbar-btn:hover {
  background: var(--border);
  color: var(--text);
}

/* 하단 액션 버튼 행 */
.result-bottom-row {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

/* 반응형: 좁은 화면에서 요약 카드 세로 정렬 */
@media (max-width: 520px) {
  .result-summary-wrap {
    grid-template-columns: 1fr;
  }
  .result-info-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* 구 summary-item 기반 손실 카드 호환 유지 */
.summary-item.result-loss-card { border: 1px solid #e5e7eb; }

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.action-row button {
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text);
  padding: 0 14px;
  border-radius: var(--btn-radius);
  cursor: pointer;
  min-height: var(--btn-h-lg);
  font-size: var(--fs-base);
  display: inline-flex;
  align-items: center;
}

.action-row button:hover:not(:disabled) {
  border-color: var(--primary);
}

.action-row button:disabled {
  color: var(--text-muted);
  border-style: dashed;
  cursor: not-allowed;
}

.placeholder-form {
  display: grid;
  gap: 8px;
}

.upload-form {
  display: grid;
  gap: 10px;
}

.admin-form-grid {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.admin-filter-form {
  grid-template-columns: minmax(200px, 280px);
}

.upload-form label {
  display: grid;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
}

.upload-form input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  background: var(--surface);
  color: var(--text);
}

.upload-form select,
.upload-form textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  background: var(--surface);
  color: var(--text);
}

.placeholder-form input,
.placeholder-form select,
.placeholder-form textarea {
  width: 100%;
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 8px;
  background: var(--surface-muted);
  color: var(--text-muted);
}

.status-grid {
  display: grid;
  gap: 8px;
}

.status-box {
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
}

.status-box.info {
  background: var(--status-info);
}

.status-box.success {
  background: var(--status-success);
}

.status-box.error {
  background: var(--status-error);
}

.status-grid ul {
  margin: 0;
  padding-left: 18px;
  color: var(--text-muted);
  font-size: 14px;
}

.section-help {
  margin: 0 0 10px;
  color: var(--text-muted);
  font-size: 14px;
}

.admin-quick-nav .action-row {
  margin-bottom: 0;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.summary-item {
  border: 1px solid var(--border);
  background: var(--surface-muted);
  border-radius: 8px;
  padding: 10px;
  display: grid;
  gap: 4px;
}

.summary-item span {
  color: var(--text-muted);
  font-size: 13px;
}

.summary-item strong {
  font-size: 18px;
}

.summary-item.sales-priority {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.summary-item.sales-priority strong {
  color: var(--primary);
  font-size: 22px;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: 8px;
  position: relative;
}
/* 모바일: 가로 스크롤 가능 힌트 (오른쪽 그라데이션) */
@media (max-width: 768px) {
  .table-wrap::after {
    content: "";
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 28px;
    background: linear-gradient(to left, var(--surface) 40%, transparent 100%);
    pointer-events: none;
    border-radius: 0 8px 8px 0;
  }
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.data-table th,
.data-table td {
  border: 1px solid var(--border);
  padding: 9px 10px;
  font-size: 13px;
  text-align: left;
}

.data-table thead th {
  background: #f5f1eb;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-align: center !important;
  position: sticky;
  top: 0;
  z-index: 1;
}

.data-table tbody tr:nth-child(even) {
  background: #fdfaf7;
}

.data-table tbody tr:hover {
  background: var(--primary-soft);
}

.table-number-input {
  width: 120px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  background: var(--surface);
  color: var(--text);
}

.table-action-btn {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  padding: 6px 8px;
  min-height: 34px;
  cursor: pointer;
}

@media (max-width: 1024px) {
  .page-content {
    max-width: 100%;
    padding: 20px;
  }
}

@media (max-width: 768px) {
  .top-nav {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 10px 12px;
    gap: 8px;
  }

  /* 1행: 로고 + 모드선택 콤보 + 사용자 정보 (로그아웃 아이콘) */
  .header-mobile-controls {
    display: contents;
  }

  .top-nav .brand {
    order: 1;
    font-size: 16px;
  }

  .top-nav .nav-mobile-select {
    order: 2;
    flex: 1;
    min-width: 80px;
    max-width: 120px;
  }

  .top-nav .nav-user-info {
    order: 3;
    margin-left: auto;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 12px;
  }

  /* 2행 줄바꿈 */
  .top-nav::after {
    content: "";
    width: 100%;
    order: 4;
    height: 0;
    overflow: hidden;
    flex-shrink: 0;
    margin: -8px 0 0 0;
  }

  /* 2행: 대시보드·매출조회 탭 버튼 + 탭 콤보 */
  .top-nav .admin-tabs-wrap {
    order: 5;
    display: flex !important;
    flex: 0 0 auto;
    gap: 6px;
    min-width: 0;
  }

  .top-nav .admin-tabs-wrap .admin-tab:nth-child(n + 3) {
    display: none;
  }

  .top-nav .admin-tabs-mobile-select {
    order: 6;
    flex: 1;
    min-width: 0;
    max-width: none;
  }

  .nav-menu {
    display: none !important;
  }

  /* 계정 정보 간결화 + 로그아웃 아이콘만 */
  .nav-user-info .nav-username {
    font-size: 12px;
  }

  .nav-user-info .nav-role-badge {
    font-size: 10px;
    padding: 2px 6px;
  }

  .nav-user-info .nav-logout-btn {
    padding: 6px;
    font-size: 12px;
  }

  .nav-user-info .nav-logout-text {
    display: none;
  }

  .nav-user-info .nav-logout-icon {
    display: inline-block;
  }

  .page-content {
    padding: 16px;
  }

  .page-header h1 {
    font-size: 24px;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .action-row button {
    flex: 1 1 160px;
  }

  .data-table {
    min-width: 620px;
  }

  .admin-form-grid,
  .admin-filter-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .top-nav {
    padding: 8px 10px;
    gap: 6px;
  }

  .top-nav .brand { font-size: 15px; }

  .top-nav .nav-mobile-select,
  .top-nav .admin-tabs-mobile-select {
    padding: 5px 8px;
    font-size: 12px;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .placeholder-card {
    padding: 16px;
  }

  .data-table {
    min-width: 560px;
  }

}

@media (max-width: 480px) {
  .page-content { padding: 12px 14px; }
}

/* ─── 로그인 페이지 ──────────────────────────────────────────────────────── */

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #fef3c7 0%, #faf8f5 60%);
}

.login-container {
  width: 100%;
  max-width: 400px;
  padding: 24px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 36px;
  box-shadow: 0 4px 24px rgba(120, 83, 30, 0.10);
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo {
  font-size: 48px;
  margin-bottom: 8px;
}

.login-title {
  margin: 0 0 4px;
  font-size: 26px;
  font-weight: 700;
  color: var(--primary);
}

.login-subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
}

.login-form {
  display: grid;
  gap: 16px;
}

.login-field {
  display: grid;
  gap: 6px;
}

.login-field label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.login-field input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 15px;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.login-field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(161, 98, 7, 0.15);
}

.login-error {
  background: var(--status-error);
  color: #b91c1c;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
}

.login-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 4px;
  transition: background 0.15s;
}

.login-btn:hover:not(:disabled) {
  background: var(--primary-hover);
}

.login-btn:disabled {
  background: #d1b896;
  cursor: not-allowed;
}

/* ─── 헤더 사용자 정보 ─────────────────────────────────────────────────── */

.nav-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.nav-username {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.nav-role-badge {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 20px;
  font-weight: 600;
}

.nav-role-super_admin {
  background: #fef3c7;
  color: #92400e;
}

.nav-role-admin {
  background: var(--primary-soft);
  color: var(--primary);
}

.nav-role-store_manager {
  background: var(--status-success);
  color: #166534;
}

/* ─── 계정 관리 탭 ──────────────────────────────────────────────────── */
.user-tab-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.user-tab-header h2 { margin: 0; }

/* 활성화 토글 스위치 */
.user-active-toggle {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  position: relative;
  width: 36px;
  height: 20px;
}
.user-active-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.user-toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 20px;
  transition: background 0.2s;
}
.user-toggle-slider::after {
  content: "";
  position: absolute;
  left: 3px; top: 3px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
}
.user-active-toggle input:checked + .user-toggle-slider { background: var(--primary); }
.user-active-toggle input:checked + .user-toggle-slider::after { transform: translateX(16px); }
.user-active-toggle input:disabled + .user-toggle-slider { opacity: 0.5; cursor: not-allowed; }

/* 매장 셀: 이름 + 변경 드롭다운 */
.user-store-cell { display: flex; flex-direction: column; gap: 4px; }
.user-store-name { font-size: var(--fs-sm); color: var(--text); }
.user-store-select {
  font-size: 11px;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-muted);
  color: var(--text);
  max-width: 140px;
}
.user-store-select:focus { outline: none; border-color: var(--primary); }

/* 계정 관리 테이블: 아이디(토글+이름+역할), 매장, 생성일시, 마지막 접속일시, 관리 버튼 열 */
.col-username-head { text-align: left !important; }
.col-username {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  line-height: 20px;
  min-height: 20px;
}
.col-username .user-name-text,
.col-username .nav-role-badge { line-height: 20px; vertical-align: middle; }
/* 계정 활성/비활성 토글: 메뉴와 동일한 mat-toggle toggle-brown 사용 */
.col-username .mat-toggle.toggle-brown { flex-shrink: 0; align-self: center; }
.col-username .user-name-text { margin-right: 6px; }
.col-username .nav-role-badge { font-size: 11px; flex-shrink: 0; }
.col-user-store { width: 84px; min-width: 84px; }  /* 매장 열: 기존 대비 30% 축소 */
.col-created-at,
.col-last-login-at { width: 140px; min-width: 140px; }  /* 생성일시/마지막 접속일시: 지금의 두 배 */
.col-user-action { width: 62px; min-width: 62px; max-width: 62px; }

/* 계정 관리 버튼 */
.btn-ghost-sm {
  padding: 4px 10px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.btn-ghost-sm:hover { background: var(--surface-muted); color: var(--text); }

/* 계정 관리 모달 섹션 타이틀 */
.user-manage-section-title {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}

.nav-logout-btn {
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}

.nav-logout-btn:hover {
  border-color: #ef4444;
  color: #ef4444;
}

/* ─── 마법사 스텝 ─────────────────────────────────────────────────────── */

.wizard-steps {
  display: flex;
  gap: 0;
  margin-bottom: 8px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.wizard-step-indicator {
  flex: 1;
  padding: 12px 8px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-muted);
  border-right: 1px solid var(--border);
  transition: all 0.2s;
}

.wizard-step-indicator:last-child {
  border-right: none;
}

.wizard-step-indicator.active {
  background: var(--primary-soft);
  color: var(--primary);
}

.wizard-step-indicator.done {
  background: var(--status-success);
  color: #166534;
}
/* 이전 단계로 이동 가능한 탭 */
.wizard-step-indicator.nav-back {
  cursor: pointer;
}
.wizard-step-indicator.nav-back:hover {
  filter: brightness(0.92);
  text-decoration: underline;
}
/* 클릭 불가 탭 (이동 제한) */
.wizard-step-indicator.nav-locked {
  cursor: not-allowed;
  opacity: 0.55;
}

/* 드래그앤드랍 업로드 영역 */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--surface-muted);
}

.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.drop-zone.has-file {
  border-color: #22c55e;
  background: var(--status-success);
}

.drop-zone-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.drop-zone-text {
  font-size: 15px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.drop-zone-filename {
  font-size: 14px;
  font-weight: 600;
  color: #166534;
  margin-top: 8px;
}

.drop-zone-btn {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.drop-zone-btn:hover {
  background: #1a50e0;
}

/* 분석 시작 버튼 */
.analyze-btn {
  width: 100%;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 16px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 16px;
  transition: background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.analyze-btn:hover:not(:disabled) {
  background: #7c4a04;
  color: #fff;
}

.analyze-btn:disabled {
  background: #d1d5db;
  color: #9ca3af;
  cursor: not-allowed;
}

/* 보고하기 버튼 */
.submit-btn {
  background: #16a34a;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 14px 32px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}

.submit-btn:hover:not(:disabled) {
  background: #15803d;
}

.submit-btn:disabled {
  background: #d1d5db;
  color: #9ca3af;
  cursor: not-allowed;
}

/* 로딩 스피너 */
.loading-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* 결과 카드 */
.result-success-card {
  background: var(--status-success);
  border: 1px solid #bbf7d0;
  border-radius: 12px;
  padding: 24px;
  text-align: center;
}

.result-success-card h3 {
  margin: 0 0 8px;
  color: #166534;
  font-size: 20px;
}

.result-success-card p {
  margin: 0;
  color: #15803d;
  font-size: 14px;
}

/* ─── 포스마감 대시보드 ─────────────────────────────────────────────────── */

.dash-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 24px 0;
  color: var(--text-muted);
  font-size: 15px;
}

.dash-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.dash-header-row h2 { margin: 0 0 2px; }
.dash-header-right  { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* 포스마감 대시보드 매장 선택 */
.dash-store-picker-wrap  { display: flex; align-items: center; gap: 6px; }
.dash-store-picker-select {
  height: var(--btn-h-md);
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--btn-radius);
  font-size: var(--fs-base);
  background: var(--surface-muted);
  color: var(--text);
  cursor: pointer;
  min-width: 120px;
}
.dash-store-picker-select:focus { outline: none; border-color: var(--primary); }
.dash-store-fixed {
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--text);
  padding: 0 8px;
}

/* ②업로드 단계 매장 읽기전용 표시 */
.upload-store-display {
  display: flex;
  align-items: center;
  color: var(--text-muted);
  background: var(--surface-muted);
  font-weight: 600;
  cursor: default;
}

.dash-closed-badge {
  background: #dcfce7;
  border: 1px solid #86efac;
  color: #166534;
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  align-self: center;
}

.dash-closed-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 10px;
  padding: 12px 16px;
  margin: 10px 0 14px;
  font-size: 14px;
  color: #166534;
}

.redo-closing-btn {
  background: #fff;
  border: 1px solid #86efac;
  color: #166534;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.redo-closing-btn:hover { background: #dcfce7; }

.analyze-btn.redo-style {
  background: var(--text-muted);
}

/* ─── 포스마감 완료 화면 ────────────────────────────────────────────────── */

.done-header {
  text-align: center;
  padding: 8px 0 16px;
}
.done-check  { font-size: 40px; margin-bottom: 6px; }
.done-title  { margin: 0 0 4px; font-size: 22px; font-weight: 800; color: var(--text); }
.done-subtitle { margin: 0; color: var(--text-muted); font-size: 14px; }

.done-loss-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--status-success);
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  padding: 10px 16px;
  margin-bottom: 14px;
  font-size: 14px;
  color: #166534;
  font-weight: 600;
}
.done-loss-bar strong { font-size: 18px; }
.done-loss-bar.loss-mid  { background: #fef9c3; border-color: #fde68a; color: #92400e; }
.done-loss-bar.loss-high { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }

.done-period-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.done-period-card {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 10px;
  text-align: center;
}
.done-period-card.highlight {
  background: var(--primary-soft);
  border-color: var(--primary);
}
.dpc-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.done-period-card.highlight .dpc-label { color: var(--primary); }
.dpc-sales {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.done-period-card.highlight .dpc-sales { color: var(--primary); }
.dpc-cost {
  font-size: 11px;
  color: var(--text-muted);
}

/* 포스마감 대시보드 KPI 카드 */
.dash-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.dash-kpi-card {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 10px;
  text-align: center;
}
.dash-kpi-today {
  background: var(--primary-soft);
  border-color: var(--primary);
}
.dkc-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.dash-kpi-today .dkc-label { color: var(--primary); }
.dkc-sales {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-kpi-today .dkc-sales { color: var(--primary); }
.dkc-sub {
  font-size: 11px;
  color: var(--text-muted);
}

/* 포스마감 대시보드 차트 (전체 너비) */
.dash-chart-full {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
}

/* ④완료 단계 차트 그리드 */
.done-charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.done-chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}
.done-chart-title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.done-chart-wrap {
  height: 200px;
  position: relative;
}

.done-closing-msg {
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  padding: 14px 0 4px;
  letter-spacing: 0.01em;
}

@media (max-width: 900px) {
  .done-period-grid   { grid-template-columns: repeat(3, 1fr); }
  .done-charts-grid   { grid-template-columns: 1fr; }
  .dash-kpi-grid      { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 600px) {
  .done-period-grid   { grid-template-columns: repeat(2, 1fr); }
  .dash-kpi-grid      { grid-template-columns: repeat(2, 1fr); }
}

/* ─── 메뉴 카드 그리드 ────────────────────────────────────────────────── */

.menu-card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.menu-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: box-shadow 0.15s;
}

.menu-card:hover {
  box-shadow: 0 2px 8px rgba(47, 103, 255, 0.10);
}

.menu-card-category {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.2;
}

.menu-card-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.menu-card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.menu-card-label {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
  width: 24px;
}

.menu-card-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.menu-card-input {
  width: 64px;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px 5px;
  font-size: 13px;
  font-weight: 600;
  text-align: right;
  background: var(--surface-muted);
  color: var(--text);
}

.menu-card-input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 2px rgba(47, 103, 255, 0.12);
}
.menu-card-input.input-error {
  border-color: #ef4444;
  background: #fff1f1;
  color: #dc2626;
}
.menu-card-hint {
  min-height: 0;
  font-size: 11px;
  text-align: right;
  padding: 0 2px;
}
.menu-card-hint.hint-error {
  color: #dc2626;
  min-height: 14px;
}

.menu-card-loss {
  font-size: 12px;
  font-weight: 600;
}

.loss-positive { color: #ef4444; }
.loss-negative { color: #22c55e; }

.menu-card-sales {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  text-align: right;
  border-top: 1px solid var(--border);
  padding-top: 4px;
  margin-top: 1px;
}

@media (max-width: 1100px) {
  .menu-card-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 760px) {
  .menu-card-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .menu-card-grid { grid-template-columns: 1fr 1fr; }
}

/* ─── 매출 빠른 날짜 선택 ─────────────────────────────────────────────── */

.sales-quick-btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.quick-btn {
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.quick-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.quick-btn.active {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

/* ─── 매출조회 탭 (Warm Latte 테마 통일) ───────────────────────────────── */
.sales-container { display: flex; flex-direction: column; gap: 20px; }
.sales-filter-wrap {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 4px;
}
.sales-quick-btn {
  height: var(--btn-h-sm); padding: 0 12px; border-radius: var(--btn-radius);
  border: 1px solid var(--border); background: var(--surface);
  font-size: var(--fs-xs); color: var(--text-muted); cursor: pointer; transition: all .15s;
}
.sales-quick-btn:hover { border-color: var(--primary); color: var(--primary); }
.sales-quick-btn.active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); font-weight: 600; }
.sales-date-form { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sales-date-form input[type="date"] {
  height: var(--input-h); padding: 0 10px; border: 1px solid var(--border);
  border-radius: var(--input-radius); font-size: var(--fs-base); background: var(--surface); color: var(--text);
}
/* 매출조회 상단 KPI: 2열×2행 */
.sales-kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.sales-kpi-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 18px 20px; min-height: 80px;
}
.sales-kpi-label { font-size: var(--fs-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.sales-kpi-value { font-size: 22px; font-weight: 700; color: var(--text); line-height: 1.2; }
.sales-panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 18px 20px;
}
.sales-panel-title { font-size: var(--fs-sm); font-weight: 600; color: var(--text-muted); margin-bottom: 14px; }
.sales-trend-wrap { position: relative; min-height: 200px; }
.sales-trend-svg { overflow: visible; display: block; }
.sales-chart-legend { display: flex; gap: 16px; margin-top: 8px; font-size: var(--fs-xs); color: var(--text-muted); }
.sales-legend-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 4px; vertical-align: middle; }
.sales-empty { color: var(--text-muted); font-size: var(--fs-sm); padding: 24px 0; text-align: center; }
/* 메뉴별/카테고리별 테이블: 셀 좌/상/우 테두리 제거, 아이템 구분선만 td 하단으로 복원 */
#tab-sales .sales-menu-table.list-2row-table td,
#tab-sales .sales-category-table.list-2row-table td {
  border-left: none !important;
  border-right: none !important;
  border-top: none !important;
  border-bottom: 1px solid var(--border);
}
#tab-sales .sales-menu-table .list-2row-table tbody tr:last-child td,
#tab-sales .sales-category-table .list-2row-table tbody tr:last-child td {
  border-bottom: none;
}
#tab-sales .sales-menu-table .list-2row,
#tab-sales .sales-category-table .list-2row {
  border-bottom: none;
}
/* 2줄 구조: 수량/매출/기여 → 줄바꿈 → 원가/원가율/마진 (메뉴) 또는 매출/기여 → 줄바꿈 → 원가/원가율 (카테고리) */
#tab-sales .list-2row-r2 {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
#tab-sales .list-2row-r2-line1,
#tab-sales .list-2row-r2-line2 {
  display: block;
}
.sales-menu-table .list-2row-r2 .dash-hc-sales-tag,
.sales-category-table .list-2row-r2 .dash-hc-sales-tag { vertical-align: middle; }

.sales-more-wrap { margin-top: 12px; text-align: center; }
.sales-more-wrap.hidden { display: none; }
.sales-more-btn {
  padding: 8px 16px;
  font-size: var(--fs-sm);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.sales-more-btn:hover { border-color: var(--primary); color: var(--primary); }

.sales-export-wrap { display: flex; gap: 10px; flex-wrap: wrap; }
.sales-export-wrap .btn-ghost-sm { border: 1px solid var(--border); color: var(--text); }
.sales-export-wrap .btn-ghost-sm:hover { border-color: var(--primary); color: var(--primary); }
@media (max-width: 600px) { .sales-kpi-value { font-size: 18px; } }
@media (max-width: 480px) {
  .sales-filter-wrap { flex-direction: column; align-items: stretch; gap: 10px; }
  .sales-quick-btns { justify-content: flex-start; }
  .sales-date-form { flex-wrap: nowrap; }
  .sales-date-form input[type="date"] { flex: 1; min-width: 0; }
  .sales-kpi-card { padding: 14px 16px; min-height: 80px; }
  .sales-kpi-value { font-size: 20px; }
  .sales-panel { padding: 14px 16px; }
  .sales-panel-title { font-size: 12px; margin-bottom: 10px; }
  #tab-sales .placeholder-card { padding: 12px 14px; }
}

/* 대시보드 CTA (매출 자세히 보기) */
.dash-cta-wrap { margin-top: 8px; }
.dash-cta-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 18px; border-radius: var(--btn-radius);
  border: 1px solid var(--primary); background: var(--primary-soft);
  color: var(--primary); font-size: var(--fs-sm); font-weight: 600; cursor: pointer; transition: all .15s;
}
.dash-cta-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ─── 관리자 탭 ─────────────────────────────────────────────────────── */

/* 관리자 탭 */
/* ─── 관리자 공통 섹션 헤더 ──────────────────────────────────────────────── */

.admin-section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.admin-section-header h2 { margin: 0; }
.admin-section-header .btn-primary-sm {
  margin-left: auto;
}

.menu-count-badge {
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 20px;
  padding: 2px 12px;
  font-size: 13px;
  font-weight: 600;
}

.menu-high-cost-badge {
  cursor: pointer;
  margin-left: 8px;
}
.menu-high-cost-badge:hover {
  opacity: 0.9;
}
.menu-high-cost-badge.active {
  background: #fff7ed;
  color: #c2410c;
  border-color: #ea580c;
}

.menu-row-high-cost {
  background: #fff7ed;
}

.menu-row-inactive {
  opacity: 0.6;
}
.menu-row-inactive .menu-cell-text--strong {
  text-decoration: line-through;
}

/* 메뉴명 셀: 토글을 메뉴명 왼쪽에 배치 (다른 비활성 토글과 동일 슬라이더) */
.col-menu-name-td .menu-active-toggle-wrap {
  flex-shrink: 0;
  margin-right: 8px;
}

.menu-active-filter-chips {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
}
.menu-active-filter-chip {
  padding: 2px 10px;
  font-size: 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
}
.menu-active-filter-chip:hover {
  background: var(--surface-muted);
  color: var(--text);
}
.menu-active-filter-chip.active {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary);
}

.btn-primary-sm {
  padding: 0 16px;
  min-height: var(--btn-h-sm);
  border-radius: 20px;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}
.btn-primary-sm:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #fff;
  opacity: 1;
}

.btn-secondary {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--btn-radius);
  padding: 0 14px;
  min-height: var(--btn-h-md);
  font-size: var(--fs-base);
  cursor: pointer;
  transition: background 0.15s;
  display: inline-flex;
  align-items: center;
}
.btn-secondary:hover { background: var(--border); color: var(--text); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--btn-radius);
  padding: 0 16px;
  min-height: var(--btn-h-md);
  font-size: var(--fs-base);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  display: inline-flex;
  align-items: center;
}
.btn-ghost:hover {
  background: var(--surface-muted);
  border-color: var(--border);
  color: var(--text);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border: 1px solid var(--primary);
  padding: 0 20px;
  min-height: var(--btn-h-md);
  border-radius: var(--btn-radius);
  font-size: var(--fs-base);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
  display: inline-flex;
  align-items: center;
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #fff;
  opacity: 0.95;
}
.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* 관리자 탭: 헤더 내 .admin-tabs-wrap 안에서 사용 (sticky/음수 마진 제거) */
.admin-tabs {
  display: flex;
  gap: 6px;
  padding: 4px 0;
  flex-shrink: 0;
  align-items: center;
}

.admin-tab {
  padding: 7px 18px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 20px;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.admin-tab:hover {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: var(--border);
}

.admin-tab.active {
  color: var(--primary-hover);
  background: var(--primary-soft);
  border-color: var(--primary);
}

.admin-tab-panel {
  display: none;
  opacity: 0;
}

.admin-tab-panel.active {
  display: block;
  animation: tabFadeIn 0.15s ease forwards;
}

@keyframes tabFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── 모든 탭 패널: 가용 높이 채우기 ─────────────────────────────────────── */

/* 활성 탭 패널은 page-content의 남은 공간을 모두 차지 */
#tab-dashboard.active,
#tab-sales.active,
#tab-menus.active,
#tab-recipes.active,
#tab-materials.active {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  animation: tabFadeIn 0.15s ease forwards;
}

/* 대시보드: placeholder-card 내부 스크롤 */
#tab-dashboard .placeholder-card {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

/* 매출조회 탭: 스크롤 가능 */
#tab-sales .placeholder-card {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

/* 메뉴 탭: placeholder-card 도 flex column */
#tab-menus .placeholder-card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* 메뉴 탭: 테이블 영역만 내부 스크롤 */
#tab-menus .table-wrap {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
#tab-menus .data-table {
  table-layout: fixed;
}

.recipe-panel-wrap {
  display: grid;
  grid-template-columns: 290px 1fr;
  gap: 16px;
  flex: 1;
  min-height: 0;
}

/* 왼쪽: 메뉴 목록 */
.recipe-panel-left {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  overflow: hidden;
}

.recipe-search-row {
  display: flex;
  gap: 6px;
  margin: 8px 0;
}

.recipe-search-row input {
  flex: 1;
  min-width: 0;
}

/* 아이콘 내장 검색창 (레시피·원재료 공통) */
.search-input-wrap {
  position: relative;
  width: 100%;
}

.search-icon-inner {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  display: flex;
  align-items: center;
}

.search-input-icon {
  width: 100%;
  height: var(--input-h);
  padding: 0 10px 0 32px;
  border: 1px solid var(--border);
  border-radius: var(--input-radius);
  font-size: var(--fs-base);
  background: var(--surface-muted);
  color: var(--text);
  transition: border-color 0.15s;
}

.search-input-icon:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
}

.btn-icon-search {
  padding: 0;
  width: var(--input-h);
  height: var(--input-h);
  border-radius: var(--btn-radius);
  border: none;
  background: var(--primary);
  color: white;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.recipe-menu-list {
  flex: 1;
  overflow-y: auto;
  list-style: none;
  padding: 0;
  margin: 0;
}

.recipe-menu-item {
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
  margin-bottom: 4px;
}

.recipe-menu-item:hover {
  background: var(--surface-muted);
}

.recipe-menu-item.active,
.recipe-menu-item.selected {
  background: var(--primary-10, #e0f2fe);
  border-left: 3px solid var(--primary);
}

/* 원재료 목록 아이템 - 주황 좌측 바 */
.recipe-menu-item.mat-type-raw {
  border-left: 3px solid #fb923c;
  padding-left: 9px;
}

.recipe-menu-item.mat-type-raw.selected {
  background: #fff7ed;
  border-left-color: #c2410c;
}

.recipe-menu-item.mat-type-raw:hover:not(.selected) {
  background: #fff7ed;
}

/* 부재료 목록 아이템 - 초록 좌측 바 */
.recipe-menu-item.mat-type-sub {
  border-left: 3px solid #34d399;
  padding-left: 9px;
}

.recipe-menu-item.mat-type-sub.selected {
  background: #f0fdf4;
  border-left-color: #15803d;
}

.recipe-menu-item.mat-type-sub:hover:not(.selected) {
  background: #f0fdf4;
}

/* 코드 라운딩 박스 (목록 + 헤더 공통) */
.mat-list-code {
  font-family: monospace;
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.4px;
  flex-shrink: 0;
  font-weight: 600;
  background: var(--surface-muted, #f8fafc);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
}

/* 목록 구분 텍스트 (서브) */
.mat-list-type {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.recipe-menu-item-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.recipe-menu-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 3px;
  font-size: 0.76rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.recipe-meta-cnt {
  color: var(--primary);
  font-weight: 600;
}

.recipe-menu-name {
  font-weight: 600;
  font-size: 0.88rem;
}

.recipe-menu-meta {
  display: flex;
  gap: 8px;
  margin-top: 3px;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.recipe-meta-ver { color: var(--primary); font-weight: 600; }
.recipe-meta-cost { color: #16a34a; font-weight: 600; }

.btn-recipe-manage {
  position: relative;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text-muted);
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 7px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn-recipe-manage:hover {
  background: var(--border);
  color: var(--text);
}
/* 미연결 메뉴: 초록 강조 + 우상단 + 뱃지 */
.btn-recipe-new {
  border-color: #86efac;
  background: #f0fdf4;
  color: #16a34a;
}
.btn-recipe-new::after {
  content: "+";
  position: absolute;
  top: -5px;
  right: -5px;
  width: 14px;
  height: 14px;
  background: #16a34a;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 14px;
  text-align: center;
  border-radius: 50%;
  border: 1.5px solid var(--surface);
}
.btn-recipe-new:hover {
  background: #dcfce7;
  border-color: #16a34a;
}

.recipe-list-loading,
.recipe-list-empty {
  padding: 16px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* 오른쪽: 레시피 상세 */
.recipe-panel-right {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* 패널 상태 클래스 */
.recipe-detail-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 40px 20px;
}

/* 레시피 선택 후 활성 상태 */
.recipe-detail-active {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

/* 재료 선택 후 활성 상태 - 자연 높이로 늘어남 */
.recipe-detail-panel {
  display: block;
}

.recipe-detail-loading-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.recipe-version-empty-msg {
  grid-column: 1 / -1;
  padding: 30px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.recipe-empty-hint {
  text-align: center;
  color: var(--text-muted);
}

.recipe-empty-icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 8px;
}

.recipe-detail-loading {
  padding: 24px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* 레시피 상세 고정 헤더 영역 */
.recipe-detail-sticky-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  padding: 16px 16px 12px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 0;
}

.recipe-detail-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.recipe-detail-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.recipe-detail-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recipe-version-count {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--surface-muted);
  border-radius: 10px;
  padding: 2px 8px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* 레시피명 인라인 수정 */
.recipe-name-edit-btn {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--btn-radius);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
}
.recipe-name-edit-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-soft);
}
.recipe-name-edit-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 360px;
}
.recipe-name-edit-wrap .recipe-name-edit-input {
  flex: 1;
  min-width: 120px;
  height: var(--input-h);
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--input-radius);
}
.recipe-name-edit-error {
  width: 100%;
  font-size: var(--fs-sm);
  color: var(--color-error);
}
.recipe-name-edit-actions {
  display: flex;
  gap: 6px;
}
.recipe-name-edit-save,
.recipe-name-edit-cancel {
  height: var(--btn-h-sm);
  padding: 0 12px;
  border-radius: var(--btn-radius);
  font-size: var(--fs-sm);
  cursor: pointer;
}
.recipe-name-edit-save {
  background: var(--primary);
  color: #fff;
  border: none;
}
.recipe-name-edit-save:hover:not(:disabled) {
  background: var(--primary-hover);
}
.recipe-name-edit-cancel {
  background: var(--surface-muted);
  color: var(--text);
  border: 1px solid var(--border);
}

/* 버전 카드 그리드 */
.recipe-version-grid {
  padding: 14px 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  overflow-y: auto;
}

/* 등록된 버전 없음 메시지는 전체 폭 차지 */
.recipe-version-grid > .recipe-detail-empty {
  grid-column: 1 / -1;
  padding: 30px 0;
}

/* 버전 카드 */
/* ── 레시피 버전 카드 (아코디언) ─────────────────────────────────────────── */
.recipe-version-card {
  background: var(--surface-muted);
  border-radius: 10px;
  margin-bottom: 0;
  border: 1px solid var(--border);
  overflow: hidden;
  transition: box-shadow 0.15s;
}
.recipe-version-card.is-active {
  border-color: #16a34a44;
  background: #f0fdf444;
}
.recipe-version-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}

/* 헤더(토글 영역) */
.recipe-version-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
  background: transparent;
  gap: 10px;
}
.recipe-version-toggle:hover {
  background: rgba(0,0,0,0.025);
}

.version-head-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.version-head-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.version-badge {
  background: var(--primary);
  color: white;
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 0.78rem;
  font-weight: 700;
}
.version-active-badge {
  background: #16a34a;
  color: white;
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 600;
}
.version-inactive-badge {
  background: #9ca3af;
  color: white;
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 600;
}
.version-date {
  color: var(--text-muted);
  font-size: 0.81rem;
}
.version-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
}
.version-cost-preview {
  font-weight: 700;
  color: var(--primary);
  font-size: 0.92rem;
}
.version-mat-count {
  font-size: 0.78rem;
  color: var(--text-muted);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1px 8px;
}
.version-chevron {
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: transform 0.2s;
  width: 16px;
  text-align: center;
}

/* 버전 카드 메모 섹션 (접기/펼치기) */
.version-memo-section {
  margin-bottom: 8px;
  font-size: 0.85rem;
}
.version-memo-header {
  display: flex;
  align-items: stretch;
  gap: 8px;
  padding: 5px 0;
}
.version-memo-current {
  flex: 1;
  min-width: 0;
  padding: 5px 9px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  font-size: 0.82rem;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
}
.version-memo-current em {
  color: var(--text-muted);
  font-style: italic;
}
.version-memo-header-actions {
  display: flex;
  align-items: stretch;
  gap: 6px;
  flex-shrink: 0;
}
.version-memo-toggle {
  font-size: var(--fs-sm);
  padding: 0 9px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--btn-radius);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  display: flex;
  align-items: center;
}
.version-memo-toggle:hover {
  background: var(--surface-muted);
  color: var(--text);
}

/* 메모 액션 버튼 공통 */
.memo-action-btn {
  padding: 0 10px;
  font-size: var(--fs-sm);
  border-radius: var(--btn-radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
  display: flex;
  align-items: center;
}
.memo-action-btn:hover:not(:disabled) {
  background: var(--surface-muted);
}
/* 수정 버튼 – 중립 아웃라인 */
.version-memo-edit-btn.memo-action-btn {
  border-color: var(--border);
  color: var(--text-muted);
  background: var(--surface-muted);
}
.version-memo-edit-btn.memo-action-btn:hover:not(:disabled) {
  background: var(--border);
  color: var(--text);
}
/* 저장 버튼 – 강조 */
.memo-action-btn--save {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}
.memo-action-btn--save:hover:not(:disabled) {
  opacity: 0.88;
}
/* 취소 버튼 – 중립 */
.memo-action-btn--cancel {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text-muted);
}
.memo-action-btn--cancel:hover:not(:disabled) {
  background: var(--surface-muted);
  color: var(--text);
}
.version-memo-body {
  padding: 6px 0 8px;
}
.version-memo-body.hidden {
  display: none;
}
.version-memo-display {
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 6px;
}
.version-memo-display em {
  color: var(--text-muted);
  font-style: italic;
}
.version-memo-edit-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.version-memo-edit-wrap.hidden {
  display: none;
}
.version-memo-textarea {
  width: 100%;
  min-height: 64px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
  resize: vertical;
  box-sizing: border-box;
  font-family: inherit;
}
.version-memo-edit-btns {
  display: flex;
  gap: 6px;
}
.version-memo-edit-btns .memo-action-btn {
  min-height: var(--btn-h-lg);
  padding: 0 16px;
  font-size: var(--fs-base);
}
.version-note-readonly {
  margin-bottom: 6px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* 버전 수정 이력 */
.version-history-wrap {
  margin-top: 8px;
}
.version-history-loading {
  font-size: 0.78rem;
  color: var(--text-muted);
  padding: 2px 0;
}
.version-history-empty {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
  padding: 2px 0;
}
/* 타임라인 이력 */
.version-history-rows {
  display: flex;
  flex-direction: column;
  padding-left: 10px;
  border-left: 2px solid var(--border);
  gap: 0;
}
.hist-row {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 2px 0 12px 16px;
  font-size: 0.78rem;
}
/* 타임라인 점 */
.hist-row::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border);
}
.hist-row:last-child {
  padding-bottom: 4px;
}
.hist-meta {
  color: var(--text-muted);
  font-size: 0.73rem;
  line-height: 1.4;
}
.hist-content-box {
  padding: 5px 10px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.82rem;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
}

/* 헤더 내 비활성/활성화 버튼 */
.version-head-active-btn {
  padding: 4px 12px;
  font-size: 0.78rem;
  border-radius: 7px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  color: var(--text);
  white-space: nowrap;
}
.version-head-active-btn:hover:not(:disabled) {
  background: var(--surface-muted);
}
.version-head-active-btn.is-deactivate {
  border-color: #fca5a5;
  color: #b91c1c;
  background: #fef2f2;
}
.version-head-active-btn.is-deactivate:hover:not(:disabled) {
  background: #fee2e2;
}
.version-head-active-btn.is-activate {
  border-color: #6ee7b7;
  color: #065f46;
  background: #ecfdf5;
}
.version-head-active-btn.is-activate:hover:not(:disabled) {
  background: #d1fae5;
}

/* 버전 카드 액션 버튼 */
.version-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.version-card-actions .btn-sm {
  padding: 0 10px;
  min-height: var(--btn-h-sm);
  font-size: var(--fs-sm);
  border-radius: var(--btn-radius);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: background 0.15s;
  display: inline-flex;
  align-items: center;
}
.version-card-actions .btn-sm:hover:not(:disabled) {
  background: var(--surface-muted);
}
.version-card-actions .btn-sm.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.version-card-actions .btn-sm.btn-primary:hover:not(:disabled) {
  opacity: 0.9;
}
.version-btn-delete {
  color: #b91c1c;
  border-color: #fecaca;
  background: #fef2f2;
}
.version-btn-delete:hover:not(:disabled) {
  background: #fee2e2;
}

/* 수정 폼 경고 배너 */
.recipe-form-warn {
  padding: 10px 12px;
  margin-bottom: 12px;
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  font-size: 0.85rem;
  color: #92400e;
}

/* 본문 (재료 테이블) */
.recipe-version-body {
  padding: 0 16px 14px;
  overflow: hidden;
  transition: max-height 0.25s ease;
}
.recipe-version-body.collapsed {
  display: none;
}

/* 재료 테이블 */
.recipe-mat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
  margin-top: 6px;
}
.recipe-mat-thead tr {
  border-bottom: 2px solid var(--border);
}
.recipe-mat-thead th {
  padding: 5px 8px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.recipe-mat-thead th.text-right {
  text-align: right;
}
.recipe-mat-table td {
  padding: 5px 8px;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}
.recipe-mat-table tr:last-child td {
  border-bottom: none;
}
.recipe-mat-table td.mat-name {
  font-weight: 500;
}
.recipe-mat-table td.mat-name-link {
  cursor: pointer;
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: transparent;
  transition: text-decoration-color 0.15s, opacity 0.15s;
}
.recipe-mat-table td.mat-name-link:hover {
  text-decoration-color: var(--accent);
  opacity: 0.82;
}
.recipe-mat-thead th.mat-type,
.recipe-mat-table td.mat-type {
  text-align: center;
}
.recipe-mat-table td.mat-qty small {
  color: var(--text-muted);
  margin-left: 2px;
  font-size: 0.76rem;
}
.recipe-mat-table td.mat-linecost {
  font-weight: 600;
  color: var(--primary);
}
.recipe-mat-table tr:hover td {
  background: rgba(0,0,0,0.025);
}

/* 재료 구분 뱃지 */
.mat-type-badge {
  font-size: 0.72rem;
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 600;
}
.mat-type-raw {
  background: #fef3c7;
  color: #92400e;
}
.mat-type-sub {
  background: #e0e7ff;
  color: #3730a3;
}

.recipe-mat-empty {
  padding: 12px;
  color: var(--text-muted);
  font-size: 0.83rem;
  text-align: center;
}

.recipe-cost-total {
  text-align: right;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 0.88rem;
  color: var(--text-muted);
}
.recipe-cost-total strong {
  color: var(--primary);
  font-size: 1rem;
  font-weight: 700;
}

/* ── 레시피 상세 헤더 액션 버튼 ─────────────────────────────────────────── */

.btn-recipe-add-ver {
  border: 1px solid var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  padding: 0 12px;
  min-height: var(--btn-h-md);
  border-radius: var(--btn-radius);
  cursor: pointer;
  font-size: var(--fs-sm);
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
}
.btn-recipe-add-ver:hover {
  background: var(--primary);
  color: #fff;
}

/* ── 레시피 등록/수정 폼 ──────────────────────────────────────────────── */

.recipe-form-wrap {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.recipe-form-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.recipe-form-subtitle {
  font-size: 0.8rem;
  background: var(--primary-soft);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}
.recipe-form-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.recipe-form-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}
.recipe-form-input {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
}
.recipe-form-input:focus {
  outline: 2px solid var(--primary);
  border-color: var(--primary);
}
.recipe-form-mat-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.recipe-form-mat-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.btn-recipe-add-mat {
  border: 1px dashed var(--border);
  background: var(--surface-muted);
  color: var(--text-muted);
  padding: 0 12px;
  min-height: var(--btn-h-md);
  border-radius: var(--btn-radius);
  cursor: pointer;
  font-size: var(--fs-sm);
  transition: border-color 0.15s, color 0.15s;
  display: inline-flex;
  align-items: center;
}
.btn-recipe-add-mat:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.recipe-form-mat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.recipe-form-mat-table th {
  background: var(--surface-muted);
  padding: 6px 8px;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.recipe-form-mat-table td {
  padding: 5px 6px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.recipe-form-select {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
  width: 100%;
  min-width: 160px;
}
.recipe-form-input-sm {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
  width: 72px;
}
.recipe-form-input-sm:focus,
.recipe-form-select:focus {
  outline: 2px solid var(--primary);
  border-color: var(--primary);
}
.rf-del-btn {
  background: none;
  border: none;
  color: #ef4444;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 4px;
}
.rf-del-btn:hover {
  background: #fee2e2;
}
.recipe-form-error {
  color: #dc2626;
  font-size: 13px;
  padding: 6px 10px;
  background: #fee2e2;
  border-radius: 6px;
}
.recipe-form-actions {
  display: flex;
  gap: 8px;
}
.btn-recipe-submit {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-recipe-submit:hover:not(:disabled) {
  opacity: 0.85;
}
.btn-recipe-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── 재료 관리 탭 ────────────────────────────────────────────────────────── */

.mat-type-tabs {
  display: flex;
  gap: 4px;
}

.mat-type-btn {
  padding: 0 16px;
  min-height: var(--btn-h-md);
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  font-size: var(--fs-sm);
  transition: background 0.15s, color 0.15s;
  display: inline-flex;
  align-items: center;
}

.mat-type-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* 원재료 필터 버튼 */
.mat-type-btn[data-type="원재료"] {
  border-color: #fed7aa;
  color: #c2410c;
}

.mat-type-btn[data-type="원재료"]:hover,
.mat-type-btn[data-type="원재료"].active {
  background: #c2410c;
  border-color: #c2410c;
  color: #fff;
}

/* 부재료 필터 버튼 */
.mat-type-btn[data-type="부재료"] {
  border-color: #bbf7d0;
  color: #15803d;
}

.mat-type-btn[data-type="부재료"]:hover,
.mat-type-btn[data-type="부재료"].active {
  background: #15803d;
  border-color: #15803d;
  color: #fff;
}

.mat-type-badge {
  border-radius: 10px;
  padding: 2px 8px;
  font-size: 0.76rem;
  font-weight: 600;
  white-space: nowrap;
}

.mat-type-raw {
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #fed7aa;
}

.mat-type-sub {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

code.mat-code {
  font-size: 0.78rem;
  background: var(--surface-muted);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--text-muted);
}

.text-right {
  text-align: right;
}

@media (max-width: 768px) {
  .recipe-panel-wrap {
    grid-template-columns: 1fr;
    height: auto;
  }

  .recipe-panel-left {
    max-height: 300px;
  }
}

@media (max-width: 520px) {
  .login-card {
    padding: 28px 20px;
  }

  .wizard-step-indicator {
    font-size: 11px;
    padding: 10px 4px;
  }
}

/* ─── 레시피 라이브러리 ──────────────────────────────────────────────────── */

.recipe-lib-actions {
  padding: 2px 0 4px;
}

.btn-recipe-new-lib {
  width: 100%;
  padding: 5px 16px;
  background: #f0fdf4;
  border: 1px dashed #16a34a;
  border-radius: 8px;
  color: #16a34a;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  box-sizing: border-box;
}

.btn-recipe-new-lib:hover {
  background: #16a34a;
  color: #fff;
}

.recipe-meta-no-ver {
  color: var(--text-muted);
  font-style: italic;
}

.recipe-detail-desc {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 6px 0 0;
}

/* ── 메뉴 관리 필터 (드롭다운 + 검색창) ──────────────────────────────────── */
.menu-filter-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.menu-filter-store {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.menu-filter-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}
.menu-store-select {
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  min-width: 120px;
}
.menu-store-select:focus {
  outline: none;
  border-color: var(--primary);
}
.menu-filter-search {
  flex: 1;
  min-width: 180px;
  position: relative;
  display: flex;
  align-items: center;
}
.menu-search-icon {
  position: absolute;
  left: 10px;
  color: var(--text-muted);
  pointer-events: none;
  flex-shrink: 0;
}
.menu-search-input {
  width: 100%;
  height: var(--input-h);
  padding: 0 12px 0 34px;
  border: 1px solid var(--border);
  border-radius: var(--input-radius);
  background: var(--surface);
  font-size: var(--fs-base);
  color: var(--text);
}
.menu-search-input:focus {
  outline: none;
  border-color: var(--primary);
}

/* 메뉴 관리 카테고리 필터 칩 */
.menu-category-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.menu-category-label {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.menu-category-add-btn {
  flex-shrink: 0;
}
.menu-category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-height: 32px;
  overflow-x: auto;
  padding: 2px 0;
}
.menu-category-chip {
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: var(--fs-sm);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.menu-category-chip:hover {
  background: var(--surface-muted);
  border-color: var(--border);
  color: var(--text);
}
.menu-category-chip.active {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-hover);
}
.menu-category-count {
  font-size: var(--fs-xs);
  opacity: 0.85;
}
.menu-category-empty {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  flex: 1;
}

/* 메뉴 테이블 연결 레시피 + 버튼 래퍼 */
.menu-recipe-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.menu-recipe-info {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  overflow: hidden;
}

/* 연결 레시피 링크 아이콘: 수정/복사 아이콘과 동일한 스타일 (우측 정렬) */
.menu-recipe-cell .btn-recipe-manage {
  flex-shrink: 0;
  margin-left: auto;
  border: none;
  background: none;
  width: auto;
  height: auto;
  padding: 2px;
  border-radius: 3px;
  color: var(--text-muted);
  opacity: 0.7;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s, color 0.15s, background 0.15s;
}
.menu-recipe-cell .btn-recipe-manage:hover {
  opacity: 1;
  color: var(--primary);
  background: var(--surface-muted);
}
.menu-recipe-cell .btn-recipe-new {
  color: #16a34a;
}
.menu-recipe-cell .btn-recipe-new:hover {
  color: #15803d;
  background: var(--surface-muted);
}
.menu-recipe-cell .btn-recipe-manage:focus {
  outline: 1px solid var(--primary);
}
.menu-recipe-cell .btn-recipe-new::after {
  display: none;
}

/* 연결된 레시피명 */
.menu-recipe-linked {
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 클릭 가능한 레시피명 */
.menu-recipe-clickable {
  cursor: pointer;
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: transparent;
  transition: text-decoration-color 0.15s, opacity 0.15s;
}
.menu-recipe-clickable:hover {
  text-decoration-color: var(--primary);
  opacity: 0.8;
}

/* 버전 배지 (메뉴 테이블 내) */
.menu-recipe-ver {
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--primary-soft);
  padding: 1px 5px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* 연결 없음 */
.menu-recipe-none {
  color: var(--text-muted);
  font-size: 0.82rem;
  font-style: italic;
}

/* ── 메뉴 가격·원가·원가율 컬럼 ────────────────────────────────────────── */

.col-price.menu-price-block-td {
  text-align: center;
  white-space: nowrap;
}

/* 판매가: 최대 5자리 숫자 + "원" */
/* 매장: 기존 대비 40% 축소 (54→32), 메뉴명 칼럼에 공간 이전 */
.col-store {
  min-width: 32px;
  width: 32px;
  vertical-align: middle;
  padding: 6px 6px;
  font-size: var(--fs-sm);
}
/* 카테고리: 메뉴명 칼럼 넓이의 60% */
.col-category {
  width: 15%;
  min-width: 60px;
  vertical-align: middle;
  padding: 6px 8px;
  border-left: 1px solid var(--border);
}
.col-category-td {
  vertical-align: middle;
  padding: 5px 8px;
  border-left: 1px solid var(--border);
  font-size: inherit;
}
.col-category-td .menu-editable-cell {
  width: 100%;
}
.col-category-td .menu-cell-text--muted {
  color: var(--text-muted);
  font-size: inherit;
  font-weight: inherit;
}
/* 메뉴명 · 연결 레시피: 매장 축소분 반영해 메뉴명 넓이 확대 */
.col-menu-name {
  width: 31%;
  min-width: 130px;
  vertical-align: middle;
  padding: 6px 8px;
  border-left: 1px solid var(--border);
}
.col-recipe {
  width: 27%;
  min-width: 115px;
  vertical-align: middle;
  padding: 6px 8px;
  border-left: 1px solid var(--border);
}
.col-menu-name-td,
.col-recipe-td {
  vertical-align: middle;
  padding: 5px 8px;
  border-left: 1px solid var(--border);
}
.col-menu-name-td .menu-editable-cell {
  width: 100%;
  min-width: 0;
  gap: 0;
}
.col-menu-name-td .menu-editable-cell .menu-cell-text--strong {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* 메뉴명: 수정·복사 아이콘을 한 묶음으로 우측에 (수정 바로 왼쪽에 복사) */
.menu-name-icons {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.menu-name-icons .menu-edit-icon-wrap {
  margin-left: 0;
}
.col-recipe-td .menu-recipe-cell {
  width: 100%;
  max-width: 100%;
}
.menu-cell-text--muted {
  color: var(--text-muted);
  font-size: 11px;
}
.menu-cell-text--strong {
  font-weight: 600;
  font-size: 13px;
}
.menu-copy-icon .menu-copy-icon-svg {
  display: block;
}
/* 판매가 칼럼: 넓이 30% 축소, 내용 중앙 정렬 */
.col-sale  { width: 60px; min-width: 60px; }
.menu-price-block-th {
  width: 60px;
  min-width: 60px;
  vertical-align: bottom;
  padding: 6px 8px 4px;
  border-left: 1px solid var(--border);
  text-align: center;
}
.menu-price-block-th .menu-price-th-top,
.menu-price-block-th .menu-price-th-bottom {
  display: block;
  font-size: 11px;
  line-height: 1.3;
}
.menu-price-block-th .menu-price-th-top { margin-bottom: 1px; }
.menu-price-block-th .menu-price-th-bottom { color: var(--text-muted); font-weight: 600; }
.menu-price-block-td {
  vertical-align: top;
  padding: 5px 8px;
  border-left: 1px solid var(--border);
  text-align: center;
}
.menu-price-block-td .menu-price-block {
  width: 100%;
}
.menu-price-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
  font-size: 12px;
}
.menu-price-block-top {
  display: flex;
  justify-content: center;
  width: 100%;
}
.menu-price-block-top .menu-editable-cell {
  width: auto;
  justify-content: center;
}
.menu-price-block-top .menu-editable-cell .menu-edit-icon-wrap {
  margin-left: 4px;
}
.menu-price-block-bottom {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  font-size: 11px;
  color: var(--text-muted);
  padding-top: 2px;
  border-top: 1px solid var(--surface-muted);
}
.menu-price-block-bottom .menu-ratio-line { font-size: 11px; }
/* 레거시 단일 컬럼 (미사용 시 유지) */
.col-cost  { width: 88px;  min-width: 76px; }
.col-cost-ratio { width: 100px; min-width: 88px; }
.menu-cost-ratio-cell { display: flex; flex-direction: column; gap: 2px; align-items: flex-end; font-size: 12px; }
.menu-cost-ratio-cell .menu-ratio-line { font-size: 11px; }
/* 원가율: "45.0%" 4~5자 */
.col-ratio { width: 68px;  min-width: 60px; }

/* 판매가 셀: 클릭 가능 — 기본은 일반 텍스트처럼, hover 시에만 힌트 */
.menu-price-clickable {
  cursor: pointer;
  white-space: nowrap;
  border-radius: 3px;
  transition: background 0.12s;
}

.menu-price-clickable:hover {
  background: var(--surface-muted);
  outline: 1px solid var(--border);
}

.menu-category-clickable {
  cursor: pointer;
  white-space: nowrap;
  border-radius: 3px;
  transition: background 0.12s;
}

.menu-category-clickable:hover {
  background: var(--surface-muted);
  outline: 1px solid var(--border);
}

.menu-name-clickable {
  cursor: pointer;
  white-space: nowrap;
  border-radius: 3px;
  transition: background 0.12s;
}
.menu-name-clickable:hover {
  background: var(--surface-muted);
  outline: 1px solid var(--border);
}

.menu-editable-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 1.5em;
}
.menu-editable-cell .menu-edit-icon-wrap {
  flex-shrink: 0;
  margin-left: auto;
  color: var(--text-muted);
  opacity: 0.7;
  cursor: pointer;
  padding: 2px;
  border-radius: 3px;
}
.menu-editable-cell .menu-edit-icon-wrap:hover {
  opacity: 1;
  color: var(--primary);
  background: var(--surface-muted);
}
.menu-edit-trigger-category:focus,
.menu-edit-trigger-name:focus,
.menu-edit-trigger-price:focus {
  outline: 1px solid var(--primary);
}

/* 판매가 편집 모달 */
.price-edit-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.price-edit-label {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.price-edit-input-wrap {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--input-radius);
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.price-edit-input-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(161, 98, 7, 0.1);
}

.price-edit-input {
  flex: 1;
  height: 44px;
  padding: 0 12px;
  border: none;
  outline: none;
  font-size: 1.15rem;
  font-weight: 700;
  background: transparent;
  color: var(--text);
  text-align: right;
}

.price-edit-unit {
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--text-muted);
  padding: 0 14px 0 4px;
  white-space: nowrap;
  user-select: none;
}

.price-edit-error {
  margin: 8px 0 0;
  font-size: 0.82rem;
  color: var(--color-error);
}

/* 판매가 수정 이력 */
.price-hist-section {
  margin-top: 16px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.price-hist-toggle {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

.price-hist-toggle:hover { color: var(--text); }

.price-hist-caret {
  font-size: 0.72rem;
  transition: transform 0.15s;
}

.price-hist-body {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
}

.price-hist-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 10px;
  background: var(--surface-muted);
  border-radius: 6px;
  border-left: 3px solid var(--primary-soft);
}

.price-hist-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.price-hist-desc {
  font-size: 0.83rem;
  color: var(--text);
  font-weight: 500;
}

.menu-price-val {
  color: var(--text);
}

.menu-cost-val {
  color: var(--text-muted);
}

.menu-no-data {
  color: var(--text-muted);
  opacity: 0.45;
}

/* 원가율 */
.menu-ratio-badge {
  display: inline-block;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.ratio-good {
  background: none;
  color: #15803d;
  border: none;
}

.ratio-mid {
  background: none;
  color: #a16207;
  border: none;
}

.ratio-bad {
  background: none;
  color: #dc2626;
  border: none;
}

/* 최신 버전 존재 알림 뱃지 */
.menu-recipe-new-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: #d97706;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* 레시피 폼 required 표시 */
.required {
  color: #ef4444;
  font-weight: 700;
}

/* ─── 레시피 연결 모달 ────────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-overlay.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(41, 37, 36, 0.4);
  backdrop-filter: blur(2px);
}

.modal-dialog {
  position: relative;
  z-index: 1;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(41, 37, 36, 0.18), 0 1px 4px rgba(0,0,0,0.08);
  width: 480px;
  max-width: 96vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
}

/* 판매가 수정 전용 좁은 모달 */
.modal-dialog--sm {
  width: 360px;
}
.modal-dialog--md {
  width: 480px;
  max-width: 95vw;
}
.modal-dialog--version-compare {
  width: 720px;
  max-width: 95vw;
}
.version-compare-selectors {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.version-compare-selectors label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-sm);
  color: var(--text-muted);
}
.version-compare-select {
  min-width: 80px;
  padding: 4px 8px;
  border-radius: var(--btn-radius);
  border: 1px solid var(--border);
}
.version-compare-vs {
  font-weight: 700;
  color: var(--text-muted);
}
.version-compare-table-wrap {
  overflow: auto;
  max-height: 60vh;
  border: 1px solid var(--border);
  border-radius: var(--btn-radius);
}
.version-compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
.version-compare-table th,
.version-compare-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.version-compare-table th {
  background: var(--surface-muted);
  font-weight: 600;
}
.version-compare-table tfoot th {
  border-bottom: none;
  border-top: 2px solid var(--border);
}
.version-diff-added {
  background: #f0fdf4;
}
.version-diff-removed {
  background: #fef2f2;
}
.version-diff-changed {
  background: #fefce8;
}
.version-diff-badge {
  font-size: var(--fs-xs);
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}
.version-diff-badge--add {
  background: #dcfce7;
  color: #166534;
}
.version-diff-badge--remove {
  background: #fee2e2;
  color: #991b1b;
}
.version-diff-badge--change {
  background: #fef9c3;
  color: #854d0e;
}
.modal-dialog--category-manage {
  width: 800px;
  max-width: 95vw;
}
/* 팝업 넓이(800px)에 맞춰 테이블이 꽉 차도록 */
.modal-dialog--category-manage .table-wrap {
  width: 100%;
}
.category-manage-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}
/* 카테고리: 팝업 넓이에서 삭제 열 뺀 나머지 전부 */
.category-manage-table .col-category-name {
  width: calc(100% - 40px);
  overflow: hidden;
  text-overflow: ellipsis;
}
.category-manage-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 1.5em;
}
.category-manage-row .mat-toggle {
  flex-shrink: 0;
}
.category-manage-row .menu-editable-cell {
  flex: 1;
  min-width: 0;
  min-height: 1.5em;
}
/* 삭제 아이콘 열: 고정 넓이만 사용 */
.category-manage-table .col-delete {
  width: 40px;
  text-align: center;
  padding: 8px 4px;
}
.category-manage-table .category-delete-icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  opacity: 0.7;
  cursor: pointer;
  padding: 4px;
  border-radius: 3px;
}
.category-manage-table .category-delete-icon-wrap:hover {
  opacity: 1;
  color: var(--color-error);
  background: var(--surface-muted);
}
/* 원재료 토글과 동일한 슬라이더 형태, 색상만 갈색 (--primary) */
.toggle-brown.mat-toggle .mat-toggle-input:checked + .mat-toggle-slider {
  background: var(--primary);
}
.toggle-brown .mat-toggle-slider {
  width: 36px;
  height: 20px;
  background: #d1d5db;
  border-radius: 10px;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}
.toggle-brown .mat-toggle-slider::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  top: 3px;
  left: 3px;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.toggle-brown .mat-toggle-input:checked + .mat-toggle-slider::after {
  transform: translateX(16px);
}
.toggle-brown .mat-toggle-input {
  display: none;
}
.category-manage-add-row {
  display: flex;
  gap: 10px;
  align-items: center;
}
.category-manage-add-row input {
  flex: 1;
  min-height: var(--input-h);
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--input-radius);
}
.col-num {
  text-align: right;
  width: 80px;
}
.category-manage-table thead th {
  text-align: center !important;
}
/* 카테고리 관리: 테이블 높이 고정 → 실시간 필터 시 팝업 높이 흔들림 방지 */
.modal-dialog--category-manage .table-wrap {
  height: 280px;
  min-height: 200px;
  overflow-y: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.modal-dialog--category-manage .category-manage-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
  box-shadow: 0 1px 0 var(--border);
}

/* 헤더: eyebrow(작은 레이블) + 타이틀 */
.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.modal-header-inner {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.modal-eyebrow {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--primary);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.modal-title {
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--text);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal-close-btn {
  background: none;
  border: none;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: 6px;
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s;
}
.modal-close-btn:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* 모달 내 폼: 라벨·입력·셀렉트 (Warm Latte 테마) */
.modal-body .admin-form-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
}
.modal-body .admin-form-grid label .required {
  color: var(--color-error);
  font-weight: 700;
}
.modal-body .admin-form-grid input[type="text"],
.modal-body .admin-form-grid input[type="password"],
.modal-body .admin-form-grid input[type="number"],
.modal-input-select {
  width: 100%;
  min-height: var(--input-h);
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--input-radius);
  font-size: var(--fs-base);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.modal-body .admin-form-grid input:focus,
.modal-input-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(161, 98, 7, 0.12);
}
.modal-body .admin-form-grid input::placeholder {
  color: var(--text-muted);
}

.modal-copy-hint {
  margin: 0 0 12px;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  line-height: 1.45;
}

.modal-form-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.modal-form-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.modal-form-section-title {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.admin-form-grid--single {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.modal-check-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-check-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text);
}
.modal-check-wrap input {
  margin: 0;
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.modal-body .status-box.error {
  margin-top: 4px;
}

/* 현재 연결 정보 배너 */
.modal-current-section {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--surface-muted);
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: var(--fs-sm);
}

.modal-label {
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.modal-recipe-current-name {
  color: var(--primary);
  font-weight: 600;
}

.modal-recipe-none {
  color: var(--text-muted);
  font-style: italic;
}

.modal-current-badge {
  display: inline-flex;
  align-items: center;
  background: var(--primary-soft);
  color: var(--primary-hover);
  font-size: var(--fs-xs);
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  margin-left: 4px;
}

.btn-unlink-recipe {
  margin-left: auto;
  border: 1px solid #fca5a5;
  background: #fef2f2;
  color: #dc2626;
  padding: 0 10px;
  min-height: var(--btn-h-sm);
  border-radius: var(--btn-radius);
  cursor: pointer;
  font-size: var(--fs-xs);
  font-weight: 600;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  display: inline-flex;
  align-items: center;
}
.btn-unlink-recipe:hover {
  background: #dc2626;
  border-color: #dc2626;
  color: #fff;
}

/* 검색 */
.modal-search-row {
  display: flex;
}
.modal-search-input {
  width: 100%;
  height: var(--input-h);
  padding: 0 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--input-radius);
  font-size: var(--fs-base);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s;
}
.modal-search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(161, 98, 7, 0.1);
}

/* 레시피 목록 */
.modal-recipe-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow-y: auto;
  max-height: 280px;
}

.modal-recipe-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.modal-recipe-item:last-child {
  border-bottom: none;
}
.modal-recipe-item:hover {
  background: var(--surface-muted);
}
.modal-recipe-item.active {
  background: var(--primary-soft);
  border-left: 3px solid var(--primary);
  padding-left: 11px;
}

.modal-recipe-name {
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--text);
}
.modal-recipe-meta {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-top: 3px;
}

.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  background: var(--surface-muted);
  border-radius: 0 0 16px 16px;
}

.btn-modal-link {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 0 22px;
  min-height: var(--btn-h-lg);
  border-radius: var(--btn-radius);
  font-size: var(--fs-base);
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
  display: inline-flex;
  align-items: center;
}
.btn-modal-link:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn-modal-link:not(:disabled):hover {
  opacity: 0.88;
}

/* ── 모달 버전 선택 섹션 ─────────────────────────────────────────────────── */
.modal-version-section {
  margin-top: 4px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}
.modal-version-section.hidden {
  display: none;
}
.modal-version-title {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}
.modal-version-loading,
.modal-version-empty {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  padding: 6px 0;
}
.modal-version-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.modal-version-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: pointer;
  background: var(--surface);
  transition: border-color 0.12s, background 0.12s;
  font-size: var(--fs-sm);
}
.modal-version-item:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.modal-version-item.active {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.modal-version-auto {
  border-style: dashed;
  color: var(--text-muted);
}
.modal-version-no {
  font-weight: 700;
  font-size: var(--fs-sm);
  color: var(--primary);
  min-width: 56px;
}
.modal-version-auto .modal-version-no {
  color: var(--text-muted);
}
.modal-version-date {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}
.modal-version-cost {
  font-weight: 600;
  font-size: var(--fs-sm);
  margin-left: auto;
}
.modal-version-note {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  font-style: italic;
}
.modal-version-current-badge {
  display: inline-block;
  background: #dcfce7;
  color: #15803d;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 8px;
  margin-left: 4px;
}

/* ── 새 버전 추가 - 이전 버전 복사 뱃지 ─────────────────────────────────── */
.recipe-form-copy-badge {
  display: inline-block;
  background: var(--primary-soft);
  color: var(--primary-hover);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 8px;
  vertical-align: middle;
}

/* ── 원재료 관리 탭 ─────────────────────────────────────────────────────── */

.mat-inactive-badge {
  display: inline-block;
  background: #f1f5f9;
  color: var(--text-muted);
  font-size: 0.68rem;
  padding: 1px 5px;
  border-radius: 8px;
  margin-left: 4px;
}

/* ── 토글 스위치 (활성/비활성) ────────────────────────────────────────────── */

.mat-toggle {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
}

.mat-toggle-input {
  display: none;
}

.mat-toggle-slider {
  width: 36px;
  height: 20px;
  background: #d1d5db;
  border-radius: 10px;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}

.mat-toggle-slider::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  top: 3px;
  left: 3px;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.mat-toggle-input:checked + .mat-toggle-slider {
  background: #22c55e;
}

.mat-toggle-input:checked + .mat-toggle-slider::after {
  transform: translateX(16px);
}

/* ── 이름 + 메타 (코드·구분) 2행 타이틀 레이아웃 ────────────────────────── */

.mat-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.mat-title-meta {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mat-code-text {
  font-family: monospace;
  font-size: 0.76rem;
  color: var(--text-muted);
  background: var(--surface-muted, #f8fafc);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  letter-spacing: 0.5px;
}

/* ── 헤더 액션 버튼 그룹 ───────────────────────────────────────────────────── */

.mat-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* 수정/저장 버튼 */
.mat-btn-edit {
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  min-height: var(--btn-h-md);
  font-size: var(--fs-base);
  font-weight: 600;
  border-radius: var(--btn-radius);
  border: 1.5px solid var(--primary);
  background: var(--primary-soft);
  color: var(--primary-hover);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.mat-btn-edit:hover {
  background: var(--primary);
  color: #fff;
}

.mat-btn-edit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* 취소 링크 버튼 (헤더 인라인) */
.mat-btn-cancel-link {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  cursor: pointer;
  padding: 0 6px;
  min-height: var(--btn-h-md);
  border-radius: 4px;
  text-decoration: underline;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}

.mat-btn-cancel-link:hover {
  color: var(--text);
}

/* 레시피 링크 텍스트 */
.mat-link {
  cursor: pointer;
  color: var(--primary);
  text-decoration: underline;
  font-weight: 600;
}

/* 기본정보 하이라이트 카드 */
.mat-highlight-row {
  display: flex;
  gap: 12px;
  margin: 14px 0 8px;
  flex-wrap: wrap;
}

.mat-highlight-item {
  flex: 1;
  min-width: 80px;
  background: var(--surface-muted, #f8fafc);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mat-highlight-item--main {
  flex: 2;
}

.mat-highlight-label {
  font-size: 0.73rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.mat-highlight-value {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.mat-highlight-unit {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-muted);
}

.mat-highlight-item:first-child .mat-highlight-value {
  color: var(--primary);
}

.mat-updated-at {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  padding-left: 2px;
}

.mat-form-section-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 12px;
}

/* 레거시 - 아직 사용중인 컴포넌트용 */
.mat-info-card {
  background: var(--surface-muted, #f8fafc);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  margin: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mat-info-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.88rem;
}

.mat-info-label {
  color: var(--text-muted);
  font-size: 0.78rem;
  min-width: 80px;
  font-weight: 500;
}

.mat-info-value {
  color: var(--text);
  font-weight: 500;
}

.mat-unit-cost {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
}

.status-active {
  color: #15803d;
  font-weight: 600;
}

.status-inactive {
  color: #b91c1c;
  font-weight: 600;
}

.mat-form-wrap {
  background: var(--surface, #fff);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-top: 12px;
}

.mat-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.mat-form-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.mat-form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.mat-form-label .required {
  color: #ef4444;
  margin-left: 2px;
}

.mat-form-input {
  padding: 0 10px;
  height: var(--input-h);
  border: 1px solid var(--border);
  border-radius: var(--input-radius);
  font-size: var(--fs-base);
  background: var(--surface, #fff);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}

.mat-form-input:focus {
  border-color: var(--primary);
}

.mat-form-input[readonly] {
  background: var(--surface-muted, #f8fafc);
  color: var(--text-muted);
}

.mat-form-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  justify-content: flex-end;
}

/* ── 원재료 단가 이력 섹션 ──────────────────────────────────────────────── */

.mat-price-history-section {
  margin-top: 20px;
}

.mat-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.mat-section-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mat-price-history-list {
  padding-left: 2px;
}

.mat-history-loading,
.mat-history-empty {
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 8px 0;
}

.mat-hist-timeline {
  display: flex;
  flex-direction: column;
  padding-left: 10px;
  border-left: 2px solid var(--border);
  gap: 0;
}

.mat-hist-row {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 2px 0 12px 16px;
}

.mat-hist-row::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border);
}

.mat-hist-row:last-child {
  padding-bottom: 4px;
}

.mat-hist-meta {
  color: var(--text-muted);
  font-size: 0.73rem;
  line-height: 1.4;
}

.mat-hist-content {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  background: var(--surface-muted, #f8fafc);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.mat-hist-cost {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary);
}

.mat-hist-reason {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.mat-hist-reason--main {
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text);
}

/* ── 단가 이력 섹션 (기본정보 탭 내) ────────────────────────────────────── */

.mat-price-section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.mat-price-more {
  display: flex;
  justify-content: center;
  margin-top: 10px;
}

.mat-btn-more {
  padding: 6px 20px;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.mat-btn-more:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* ── 상세 본문 영역 ──────────────────────────────────────────────────────── */

.mat-detail-body {
  padding: 6px 16px 16px;
}

/* ── 단가 + 최종수정 인포바 ──────────────────────────────────────────────── */

.mat-info-bar {
  display: flex;
  align-items: stretch;
  background: var(--surface, #fff);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 12px;
}

.mat-info-bar-item {
  display: flex;
  flex-direction: column;
  padding: 12px 20px;
  gap: 4px;
  justify-content: center;
}

.mat-info-bar-item--main {
  flex: 1;
}

/* 인포바 타입별 배경색 */
.mat-info-bar.mat-type-raw {
  background: #fff7ed;
  border-color: #fed7aa;
}

.mat-info-bar.mat-type-raw .mat-info-bar-sep {
  background: #fed7aa;
}

.mat-info-bar.mat-type-sub {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.mat-info-bar.mat-type-sub .mat-info-bar-sep {
  background: #bbf7d0;
}

/* 코드·구분 섹션 (인포바 좌측) */
.mat-info-bar-item--code {
  gap: 6px;
  min-width: 80px;
  align-items: flex-start;
}

.mat-info-code {
  font-family: monospace;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.5px;
}

.mat-info-bar-sep {
  width: 1px;
  background: var(--border);
  flex-shrink: 0;
}

.mat-info-bar-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mat-info-bar-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
}

.mat-info-bar-unit {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-muted);
}

.mat-info-bar-date {
  font-size: 0.88rem;
  font-weight: 400;
  color: var(--text);
}

/* ── 사용 레시피 버튼 ────────────────────────────────────────────────────── */

.mat-recipe-usage-row {
  margin-bottom: 14px;
}

.mat-recipe-usage-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  font-size: 0.82rem;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--surface, #fff);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.mat-recipe-usage-btn::before {
  content: "📋";
  font-size: 0.82rem;
}

.mat-recipe-usage-btn:not(:disabled):hover {
  border-color: var(--primary);
  color: var(--primary);
}

.mat-recipe-usage-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.mat-recipe-usage-btn--empty::before {
  content: "—";
  font-size: 0.8rem;
}

/* ── 사용 레시피 팝업 ────────────────────────────────────────────────────── */

.mat-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.38);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.mat-popup {
  background: var(--card-bg, #fff);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  width: 400px;
  max-width: 92vw;
  max-height: 60vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.mat-popup-title {
  font-weight: 700;
  font-size: 0.95rem;
}

.mat-popup-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: 4px;
  line-height: 1;
}

.mat-popup-close:hover {
  background: var(--surface-muted, #f8fafc);
  color: var(--text);
}

.mat-popup-body {
  padding: 12px 16px;
  overflow-y: auto;
}

.mat-popup-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mat-popup-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.mat-popup-recipe-link {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  font-size: 0.88rem;
  text-align: left;
}

.mat-popup-status {
  font-size: 0.78rem;
  flex-shrink: 0;
}

/* ── 구매 관리 탭 ─────────────────────────────────────────────────────────── */

.purchase-date-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 8px 0 4px;
}

.purchase-date-row .mat-form-input {
  flex: 1;
  min-width: 0;
  font-size: 0.82rem;
  padding: 6px 8px;
}

.purchase-item-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.purchase-item-row .mat-form-input {
  padding: 6px 8px;
  font-size: 0.82rem;
}

.purchase-item-row select.mat-form-input {
  flex: 1;
  min-width: 140px;
}

.purchase-item-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px 6px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}

.purchase-item-remove:hover {
  color: #b91c1c;
  background: #fee2e2;
}

/* ── 원재료 헤더 (sticky) ─────────────────────────────────────────────────── */

.mat-detail-header {
  padding-bottom: 4px !important;
  border-bottom: none !important;  /* 이름 아래 실선 제거 */
}

/* ── 원재료 서브탭 ────────────────────────────────────────────────────────── */

.mat-subtabs {
  display: flex;
  gap: 0;
  margin: 12px -16px 0;  /* sticky header 좌우 패딩 상쇄 */
  padding: 0 16px;
  border-bottom: 2px solid var(--border);
  overflow-x: auto;
}

.mat-subtab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.mat-subtab:hover {
  color: var(--text);
}

.mat-subtab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 700;
}

.mat-subtab-panel {
  display: none;
  padding: 16px;
}

.mat-subtab-panel.active {
  display: block;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Admin Dashboard
───────────────────────────────────────────────────────────────────────────── */
.dash-container { display: flex; flex-direction: column; gap: 20px; }

/* 헤더 */
.dash-header { display: flex; align-items: center; gap: 12px; }
.dash-title   { margin: 0; font-size: var(--fs-md); font-weight: 700; }
.dash-store-select {
  height: var(--input-h); padding: 0 10px; border: 1px solid var(--border);
  border-radius: var(--input-radius); font-size: var(--fs-base);
  background: var(--surface); color: var(--text); cursor: pointer;
}
.dash-store-select:focus { outline: none; border-color: var(--primary); }

/* 알림 배너 */
.dash-alert-wrap { display: flex; flex-direction: column; gap: 6px; }
.dash-alert {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-radius: 8px; font-size: var(--fs-sm);
  border: 1px solid transparent;
}
.dash-alert--ok       { background: #f0faf3; border-color: #b6dfc4; color: #287a47; }
.dash-alert--info     { background: #f0f7ff; border-color: #b3d0f5; color: #2355a0; }
.dash-alert--warning  { background: #fffbec; border-color: #f5d87a; color: #8a6000; }
.dash-alert--error    { background: #fff3f0; border-color: #f5b3a3; color: #b03020; }
.dash-alert--loading  { background: var(--surface-muted); color: var(--text-muted); }
.dash-alert-icon { font-weight: 700; font-size: 13px; }

/* KPI 카드 그리드: 2열×2행 */
.dash-kpi-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px;
}
.dash-kpi-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 18px 20px; min-height: 100px;
}
.dash-kpi-label { font-size: var(--fs-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.dash-kpi-value { font-size: 22px; font-weight: 700; color: var(--text); line-height: 1.2; }
.dash-kpi-sub   { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 4px; }
.dash-kpi-mom   { display: inline-block; margin-top: 8px; font-size: var(--fs-xs); font-weight: 600; padding: 2px 7px; border-radius: 20px; }
.dash-kpi-mom--up-good   { background: #e8f8ee; color: #287a47; }
.dash-kpi-mom--up-bad    { background: #fff0ee; color: #b03020; }
.dash-kpi-mom--down-good { background: #e8f8ee; color: #287a47; }
.dash-kpi-mom--down-bad  { background: #fff0ee; color: #b03020; }
.dash-kpi-mom--neutral   { background: var(--surface-muted); color: var(--text-muted); }
.dash-kpi-skel { height: 80px; background: var(--surface-muted); border-radius: 8px; animation: dash-pulse 1.2s infinite; }
@keyframes dash-pulse { 0%,100%{opacity:.6} 50%{opacity:1} }

/* 2열 레이아웃 */
.dash-row-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
/* 3열 레이아웃 — 메뉴기여 + 원가율주의 + 마감캘린더 */
.dash-row-3col { display: grid; grid-template-columns: minmax(0,2fr) minmax(0,2fr) minmax(0,1.5fr); gap: 16px; align-items: start; }

/* 패널 공통 */
.dash-panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 18px 20px;
}
.dash-panel-title { font-size: var(--fs-sm); font-weight: 600; color: var(--text-muted); margin-bottom: 14px; }
.dash-empty { color: var(--text-muted); font-size: var(--fs-sm); padding: 24px 0; text-align: center; }

/* 트렌드 차트 */
.dash-trend-wrap { position: relative; }
.dash-trend-svg  { overflow: visible; }
.dash-chart-tick { font-size: 10px; fill: var(--text-muted); font-family: inherit; }
.dash-dot        { pointer-events: none; }
.dash-chart-hit  { cursor: crosshair; }
.dash-chart-tooltip {
  position: absolute; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 12px; font-size: var(--fs-xs); line-height: 1.6;
  box-shadow: 0 4px 14px rgba(0,0,0,.1); pointer-events: none; white-space: nowrap; z-index: 10;
}
.dash-chart-legend { display: flex; gap: 16px; margin-top: 8px; }
.dash-legend-item  { display: flex; align-items: center; gap: 5px; font-size: var(--fs-xs); color: var(--text-muted); }
.dash-legend-dot   { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dash-skel-bar     { height: 180px; background: var(--surface-muted); border-radius: 8px; animation: dash-pulse 1.2s infinite; }

/* 가로 막대 차트 */
/* 메뉴별 매출기여 + 마감 캘린더 — 같은 행에서 높이 통일 */
.dash-row-2col { align-items: stretch; }
.dash-row-2col .dash-panel { display: flex; flex-direction: column; }
.dash-bar-chart-wrap { display: flex; flex-direction: column; gap: 0; flex: 1; justify-content: space-between; }
.dash-bar-row        { display: grid; grid-template-columns: 130px 1fr 108px; align-items: center; gap: 8px; padding: 5px 0; }
.dash-bar-row + .dash-bar-row { border-top: 1px solid var(--border); }
.dash-bar-label      { font-size: 12px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-bar-track      { background: var(--surface-muted); border-radius: 3px; height: 8px; overflow: hidden; }
.dash-bar-fill       { height: 100%; border-radius: 3px; transition: width .4s; }
.dash-bar-ratio-good { background: #3daf6f; }
.dash-bar-ratio-mid  { background: #e8a826; }
.dash-bar-ratio-bad  { background: #d94f3a; }
.dash-bar-meta       { display: flex; align-items: center; gap: 5px; font-size: 12px; justify-content: flex-end; }
.dash-ratio-tag      { padding: 1px 5px; border-radius: 8px; font-weight: 600; font-size: 11px; }
.dash-ratio-good { background: #e8f8ee; color: #287a47; }
.dash-ratio-mid  { background: #fffbec; color: #8a6000; }
.dash-ratio-bad  { background: #fff0ee; color: #b03020; }

/* 1열 2행 리스트 (횡스크롤 없음): 대시보드 원가율 주의, 매출조회 메뉴별/카테고리별 */
.list-2row-wrap { display: flex; flex-direction: column; gap: 0; }
.list-2row-item,
.list-2row { padding: 10px 0; border-bottom: 1px solid var(--border); }
.list-2row-item:last-child,
.list-2row-table tbody tr:last-child td .list-2row { border-bottom: none; }
.list-2row-r1 { font-weight: 600; font-size: var(--fs-sm); color: var(--text); margin-bottom: 4px; }
.list-2row-r2 { font-size: var(--fs-xs); color: var(--text-muted); line-height: 1.5; }
.list-2row-r2 .cost-badge { vertical-align: middle; }

/* 원가율 주의 메뉴: 매출 금액 태그 하이라이트 (모바일에서 눈에 띄게) */
.dash-hc-sales-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
  font-size: var(--fs-xs);
  background: var(--primary-soft);
  color: var(--primary-hover);
  border: 1px solid var(--primary);
  vertical-align: middle;
}

.list-2row-thead-hidden { display: none !important; }
.list-2row-table { display: block; min-width: 0; }
.list-2row-table tbody { display: block; }
.list-2row-table tr { display: block; border: none; }
.list-2row-table td { display: block; width: 100%; box-sizing: border-box; border-left: none; border-right: none; border-top: none; }

/* 원가율 주의 메뉴 테이블 — 전체폭 패널이므로 sticky 헤더 비활성화 (레거시 테이블용) */
.dash-hc-table thead th {
  position: static !important;
}

/* cost-badge (원가율 주의 테이블) */
.cost-badge       { padding: 2px 8px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.cost-badge--good { background: #e8f8ee; color: #287a47; }
.cost-badge--mid  { background: #fffbec; color: #8a6000; }
.cost-badge--bad  { background: #fff0ee; color: #b03020; }

/* 마감 캘린더 */
.dash-cal-grid    { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.dash-cal-header  { text-align: center; font-size: 10px; font-weight: 600; color: var(--text-muted); padding: 4px 0; }
.dash-cal-blank   { }
.dash-cal-cell    {
  border-radius: 5px; min-height: 32px; padding: 2px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 1px solid transparent; font-size: 11px;
}
.dash-cal-day     { font-weight: 600; font-size: 11px; }
.dash-cal-icon    { font-size: 9px; margin-top: 1px; }
.cal-closed-full    { background: #e8f8ee; border-color: #b6dfc4; color: #287a47; }
.cal-closed-partial { background: #fffbec; border-color: #f5d87a; color: #8a6000; }
.cal-open           { background: #fff3f0; border-color: #f5b3a3; color: #b03020; }
/* 전/다음달 날짜 셀 */
.dash-cal-other { opacity: 0.35; cursor: default !important; }
.dash-cal-other:hover { opacity: 0.35 !important; }
.dash-cal-legend    { display: flex; gap: 14px; margin-top: 10px; flex-wrap: wrap; }
.dash-cal-leg-item  { display: flex; align-items: center; gap: 5px; font-size: var(--fs-xs); color: var(--text-muted); }
.dash-cal-leg-dot   { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

/* 기간별 매출 상세 */
.dash-sales-detail   { margin-top: 0; }
.dash-sales-filter   { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.dash-quick-btns     { display: flex; gap: 6px; }
.dash-quick-btn {
  height: var(--btn-h-sm); padding: 0 12px; border-radius: var(--btn-radius);
  border: 1px solid var(--border); background: var(--surface);
  font-size: var(--fs-xs); color: var(--text-muted); cursor: pointer; transition: all .15s;
}
.dash-quick-btn:hover  { border-color: var(--primary); color: var(--primary); }
.dash-quick-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.dash-sales-form     { display: flex; align-items: center; gap: 6px; }
.dash-sales-summary  { display: flex; gap: 20px; font-size: var(--fs-sm); color: var(--text-muted); margin-bottom: 10px; }
.dash-sales-summary strong { color: var(--text); font-weight: 600; }

/* 반응형 */
@media (max-width: 1200px) {
  .dash-row-3col   { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 1100px) {
  .dash-row-2col   { grid-template-columns: 1fr; }
  .dash-row-3col   { grid-template-columns: 1fr; }
  /* 모바일: 메뉴명 30% 넓히고 그래프 구간 축소 */
  .dash-bar-row    { grid-template-columns: 130px 1fr 90px; }
}
@media (max-width: 640px) {
  .dash-kpi-value { font-size: 18px; }
}
/* 모바일: 480px 이하 — 한눈에 들어오도록 정리 */
@media (max-width: 480px) {
  .dash-header { flex-wrap: wrap; gap: 10px; }
  .dash-title { flex: 1 1 100%; }
  .dash-store-select { min-width: 140px; max-width: 100%; }
  .dash-kpi-value { font-size: 20px; }
  .dash-kpi-card { padding: 14px 16px; min-height: 88px; }
  /* 모바일: 메뉴명 30% 넓히고 그래프 구간 축소 (72→94) */
  .dash-bar-row { grid-template-columns: 94px 1fr 70px; gap: 6px; padding: 4px 0; }
  .dash-bar-label { font-size: 11px; }
  .dash-bar-meta { font-size: 11px; flex-wrap: wrap; justify-content: flex-end; }
  .dash-ratio-tag { font-size: 10px; }
  .dash-panel { padding: 14px 16px; }
  .dash-panel-title { font-size: 12px; margin-bottom: 10px; }
  .dash-cal-cell { min-height: 36px; padding: 4px; }
  .dash-cal-day { font-size: 12px; }
  .dash-cal-header { font-size: 11px; }
  .dash-cal-legend { gap: 10px; margin-top: 8px; }
  #tab-dashboard .placeholder-card { padding: 12px 14px; }
}
