/* =========================================================
   Brandaweek Admin — Design System (순수 커스텀 CSS + 토큰, Tailwind 유틸 미사용)
   ========================================================= */

/* 2026-07-06: Admin은 Tailwind 유틸리티 클래스를 쓰지 않고(사용 0건) 커스텀 CSS/토큰/인라인만 쓴다.
   Admin에는 Tailwind 빌드 스텝이 없어 tailwindcss 임포트 지시문이 소스 그대로 서빙되면
   브라우저가 /css/tailwindcss 를 404로 요청한다(콘솔 에러 상시). 죽은 임포트 제거 → 404 해소. */

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

/* =========================================================
   THEME TOKENS
   ========================================================= */

/* --- Dark theme (default) --- */
[data-theme="dark"] {
    --bg:        #08090a;
    --nav-bg:    #0f1011;
    --card:      #141516;
    /* 라인/테두리 색 — 관리자 전체(테이블·카드·사이드바·탑바·폼 등)의 모든 라인이 이 토큰을 사용.
       2026-07-04 요청: 다크 테마에서 라인을 현재보다 약 +30% 더 환하게.
       기존 #363c44(rgb 54,60,68) → 밝기 ×1.3 → #464e58(rgb 70,78,88). */
    --border:    #464e58;
    --hover:     #1e2226;
    --accent:    #e4e4e7;
    --accent-fg: #18181b;
    --nav-text:  #ffffff;
    --text-1:    #ffffff;
    --text-2:    #edf0f6;
    --text-3:    #ccd2de;
    --danger:    #f87171;
    --warning:   #fbbf24;
    --success:   #4ade80;
    --info:      #60a5fa;
    --shadow:    0 1px 3px rgba(0,0,0,0.5), 0 4px 12px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.6);
    --radius:    0;
    --radius-sm: 0;
    --font-mono: 'Inter', system-ui, sans-serif;
}

/* --- Light theme --- */
[data-theme="light"] {
    --bg:        #fcfcfd;   /* 콘텐츠 배경 — 더 옅은 회색(거의 화이트, 카드와 미세 대비) */
    --nav-bg:    #ffffff;
    --card:      #ffffff;
    /* 라인/테두리 색 — 관리자 전체의 모든 라인이 이 토큰을 사용.
       2026-07-04 요청: 라이트 테마에서 라인을 현재보다 약 -15% 더 진하게(당초 -30%에서 완화).
       기존 #d0d5dc(rgb 208,213,220) → 밝기 ×0.85 → #b1b5bb(rgb 177,181,187). */
    --border:    #b1b5bb;
    --hover:     #f0f2f5;
    --accent:    #3f3f46;
    --accent-fg: #fafafa;
    --nav-text:  #000000;
    --text-1:    #000000;
    --text-2:    #0e131c;
    --text-3:    #333b47;
    --danger:    #ef4444;
    --warning:   #f59e0b;
    --success:   #22c55e;
    --info:      #3b82f6;
    --shadow:    0 1px 3px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.04);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.10);
    --radius:    0;
    --radius-sm: 0;
    --font-mono: 'Inter', system-ui, sans-serif;
}

/* =========================================================
   GLOBAL RESET & BASE
   ========================================================= */

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-size: 14px;
    -webkit-text-size-adjust: 100%;
    overflow-x: clip; /* sticky 동작 유지하면서 가로 스크롤 차단 */
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg);
    color: var(--text-1);
    line-height: 1.5;
    margin: 0;
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* =========================================================
   LAYOUT — 52px topbar + 180px sidebar + main
   ========================================================= */

.admin-layout {
    display: grid;
    grid-template-rows: 52px 1fr;
    grid-template-columns: 180px 1fr;
    grid-template-areas:
        "topbar topbar"
        "sidebar main";
    height: 100vh; /* 뷰포트에 고정 — 내부 스크롤 방식 */
}

/* --- Topbar --- */
.topbar {
    grid-area: topbar;
    background: var(--nav-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

/* 활성몰 색 띠 (2026-08-13, 시안 C4 — design/admin-active-mall.html).
   탑바 맨 위 3px. 색은 몰 설정(site.admin_color)에서 오므로 여기서 색을 정하지 않는다
   (인라인 style 로 주입 — AdminMallColor.Normalize 를 통과한 #rrggbb 만).
   ⚠ .topbar 가 position:sticky 라 이 절대배치의 기준이 된다. 탑바 밖으로 빼면
     admin-layout 의 grid-template-areas 가 어긋나 레이아웃이 깨진다.
   색이 지정되지 않은 몰에서는 이 요소가 아예 렌더되지 않는다(기존 화면과 동일). */
.mall-color-bar {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    pointer-events: none;   /* 탑바 클릭을 가로채지 않는다 */
}

.topbar-spacer { flex: 1; }

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-right: 20px;
}

/* 로고 */
.topbar-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 170px;
    height: 52px;
    padding: 0 20px;
    border-right: 1px solid var(--border);
    flex-shrink: 0;
    text-decoration: none;
}

.logo-mark {
    width: 26px;
    height: 26px;
    /* 파비콘 기준 로고 마크(2026-07-08, 2026-07-21 QuickShop 포크로 글자 B→Q): 라운드 사각형 + 볼드 "Q".
       배경/글자색은 테마별로 반전(아래 [data-theme] 규칙)하므로 여기서 고정하지 않는다. */
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.logo-mark svg { width: 14px; height: 14px; }

/* 로고 마크 "Q" 글자 — 파비콘의 흰색 900 볼드 Q. 색은 테마별 반전.
   (2026-07-21 QuickShop 포크: 글자와 클래스명을 B→Q 로 함께 변경 — 이름이 글자를 따라가야
    다음 사람이 `.logo-b` 를 찾다가 "Q 가 왜 여기 있지?" 로 헤매지 않는다.) */
.logo-q {
    font-weight: 900;
    font-size: 17px;
    line-height: 1;
    letter-spacing: 0;
}

/* 테마별 색 반전: 파비콘은 항상 '검정 사각형+흰 Q'지만, 다크 탑바(#0f1011)에선 검정 사각형이 묻히므로
   다크에서는 밝은 사각형+검정 Q 로 반전해 대비를 확보한다. 라이트는 파비콘 그대로(검정 사각형+흰 Q). */
[data-theme="dark"] .logo-mark { background: #f4f4f5; }
[data-theme="dark"] .logo-q    { color: #0a0a0a; }
[data-theme="light"] .logo-mark { background: #0a0a0a; }
[data-theme="light"] .logo-q    { color: #ffffff; }

.logo-name {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -.02em;
    color: var(--text-1);
    line-height: 1.2;
}

.logo-sub {
    font-size: 10px;
    color: var(--text-2);
    letter-spacing: .05em;
    line-height: 1.2;
}

/* 워드마크 하단 "ADMIN" — 파비콘의 빨강 ADMIN 반영(두 테마 공통, 빨강은 양쪽에서 대비 충분). */
.logo-sub-admin {
    color: #ff3b30;
    font-weight: 800;
}

/* 테마 버튼 */
.theme-btn {
    width: 32px;
    height: 32px;
    background: var(--hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-2);
    transition: background .15s, color .15s;
    flex-shrink: 0;
}

.theme-btn:hover { background: var(--border); color: var(--text-1); }
.theme-btn svg { width: 15px; height: 15px; }

/* 알림 버튼 */
.notif-btn {
    position: relative;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-2);
    border-radius: var(--radius-sm);
    transition: background .15s;
    flex-shrink: 0;
}

.notif-btn:hover { background: var(--hover); color: var(--text-1); }
.notif-btn svg { width: 17px; height: 17px; }

.notif-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 7px;
    height: 7px;
    background: var(--accent);
    border-radius: 50%;
    border: 2px solid var(--nav-bg);
}

/* 프로필 칩 */
.profile-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px 4px 4px;
    background: var(--hover);
    border: 1px solid var(--border);
    border-radius: 0;
    cursor: pointer;
    transition: background .15s;
}

.profile-chip:hover { background: var(--border); }

.profile-avatar {
    width: 24px;
    height: 24px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: var(--accent-fg);
    flex-shrink: 0;
}

.profile-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-1);
    white-space: nowrap;
}

/* --- Sidebar --- */
.sidebar {
    grid-area: sidebar;
    background: var(--nav-bg);
    border-right: 1px solid var(--border);
    width: 170px;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.nav-section {
    padding: 8px 0 4px;
}

.nav-section-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-3);
    padding: 12px 16px 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 16px;
    color: var(--nav-text);
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    border-radius: 0;
    margin: 0;
    transition: background 0.15s, color 0.15s;
    cursor: pointer;
    position: relative;
}

.nav-item:hover {
    background: var(--hover);
    color: var(--text-1);
}

.nav-item.active {
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    color: var(--accent);
    font-weight: 600;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 4px;
    bottom: 4px;
    width: 3px;
    background: var(--accent);
    border-radius: 0;
}

.nav-icon {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    opacity: .85;
}

.nav-item.active .nav-icon { opacity: 1; }

/* ============================================================================
   검색 필터 바 (.filter-bar) — 한 줄 컨트롤의 높이·정렬 통일 (2026-08-19 사용자 제보)
   ----------------------------------------------------------------------------
   실측(제보 화면 /Orders/Process01)에서 **한 줄에 높이가 4가지**였다:
     날짜 input 35 · select/검색어 33 · 검색 버튼 30 · 초기화 28
   게다가 `align-items:flex-end` 라 **바닥만 맞고 윗변이 들쭉날쭉**했다 —
   "크기 또는 정렬이 안 맞는다"는 인상은 여기서 온다.

   ⚠ `.btn` 에 전역으로 높이를 주지 않는다 — 관리자 전반에 인라인으로 작게 줄여 쓴 버튼이
     67곳 있어(테이블 안 조밀한 행), 전역 높이를 주면 그 행들이 전부 두꺼워진다.
     그래서 **검색 폼(.filter-bar) 안에서만** 높이를 맞춘다.
   ============================================================================ */
/* ⚠ display:flex 를 **클래스가 직접** 갖는다(2026-08-19 보강).
   처음에는 align-items 만 정의했는데, 그건 기존 화면들이 인라인 style 로 display:flex 를 갖고 있어
   가능했던 것이다. 인라인 없이 class 만 붙인 화면(SKU 재고)에서 **검색줄이 세로로 쌓였다.**
   인라인 style 이 있는 기존 화면은 인라인이 이기므로 이 선언을 더해도 영향이 없다. */
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter-bar .form-control,
.filter-bar .btn {
    height: 34px;                              /* 날짜 input(35)에 맞춰 한 값으로 통일 */
    padding-top: 0;
    padding-bottom: 0;
}
/* select 는 브라우저 기본 여백이 남아 글자가 살짝 위로 뜬다 — 세로 가운데로 고정. */
.filter-bar select.form-control { line-height: normal; }

/* ============================================================================
   목록 액션 버튼 (.act) — "상태 vs 액션" 구분 (2026-08-19 사용자 제보)
   ----------------------------------------------------------------------------
   문제: 주문 목록 헤더에 결제대기·진행중(상태 태그)과 전체취소·상세(버튼)가 **같은 크기·같은
        파스텔 채움**으로 나란히 있어 무엇을 눌러야 하는지 분간이 안 됐다. 구분 장치가
        '모서리 6px(.bw-tag) vs 0(.btn)' 하나뿐인데 11px 크기에서는 보이지 않는다.
        결정적으로 .btn-danger 가 **배경을 채워서**(danger 12%) 상태 태그와 똑같이 읽혔다.

   규칙(시안 design/admin-order-list-status-vs-action.html 확정):
     · 상태 = 둥근 모서리 · 배경 채움 · 축 아이콘   → 읽는 것
     · 액션 = 각진 모서리 · 배경 **비움**(테두리만) · 동작 아이콘 → 누르는 것
   ⚠ 액션에 배경을 채우지 않는다. 채우는 순간 상태 태그와 같은 물건이 된다.
      예외는 **주 액션 하나(.act-main)** 뿐 — 행마다 1개만 쓴다.
   ⚠ 위험 액션(.act-danger)도 배경을 채우지 않는다. 글자·테두리만 danger.
   ============================================================================ */
.act {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border-radius: 0;                 /* 각진 것이 액션의 신호다 */
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text-1);
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    padding: 5px 10px;
    white-space: nowrap;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, border-color .15s;
}
.act:hover:not(:disabled) { background: var(--hover); }
.act:disabled { opacity: .45; cursor: default; }
.act svg {
    width: 12px; height: 12px; flex-shrink: 0;
    fill: none; stroke: currentColor; stroke-width: 2;
    stroke-linecap: round; stroke-linejoin: round;
}
/* 주 액션 — 행마다 1개만(대개 '상세보기'). 유일하게 채움을 허용한다. */
.act-main { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.act-main:hover:not(:disabled) { background: var(--accent); opacity: .9; }
/* 위험/되돌릴 수 없는 액션 — 글자·테두리만 danger(배경 채움 금지). */
.act-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.act-danger:hover:not(:disabled) { background: color-mix(in srgb, var(--danger) 8%, transparent); }
/* 상품 행 안의 작은 액션 */
.act-xs { padding: 3px 7px; font-size: 10px; }

/* 상태 묶음 | 구분선 | 액션 묶음 — "왼쪽=사실, 오른쪽=할 일" */
.zone-status  { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.zone-actions { display: inline-flex; align-items: center; gap: 6px; }
.zone-sep     { width: 1px; align-self: stretch; min-height: 22px; background: var(--border); margin: 0 2px; }

/* --- 사이드바 처리 대기 배지 (.nav-badge) ---
   ⚠ 2026-08-19 신설. 디자인 시스템 문서에는 이 규격이 오래전부터 있었는데 **CSS 구현이 없었다.**
      그래서 사이드바에 숫자를 붙이자 스타일 없는 맨 텍스트로 렌더돼 "라벨에 숫자가 흘러붙은" 모양이 됐다
      (사용자 제보: "배지 숫자를 좀더 잘 보이게").
   · margin-left:auto — 숫자를 오른쪽 끝에 **세로로 정렬**시킨다. 훑을 때 눈이 한 줄을 따라간다.
   · 알약형(radius 10px)은 각진 기조의 **의도적 예외**다(.badge 와 같은 취급).
   · 접힘 상태에서는 위의 `.sidebar-collapsed .nav-item span { display:none }` 이 그대로 숨긴다. */
.nav-badge {
    margin-left: auto;
    background: var(--accent);
    color: var(--accent-fg);
    font-size: 10px;
    font-weight: 700;
    line-height: 1.5;
    padding: 1px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    flex-shrink: 0;
}

/* 클레임(취소·교환·반품)만 브랜드레드 — 정방향 단계는 순서대로 처리하면 되는 일이지만
   클레임은 방치하면 고객 불만으로 번진다. **색은 딱 두 가지만** 쓴다 — 단계마다 색을 나누면
   신호가 흐려져 결국 아무것도 강조되지 않는다. */
.nav-badge.nav-badge-alert {
    background: var(--danger);
    color: #fff;
}

/* --- 탭 건수 배지 (.tab-count) ---
   2026-08-19 신설. 종전에는 비활성 탭에 .badge-default(= --hover 배경 + text-2 글자)를 써서
   **회색 위 회색**이 됐다. 정작 봐야 할 정보는 "지금 보고 있지 않은 탭에 몇 건 있나" 인데
   그게 가장 안 보였다. → 비활성은 흰(카드) 배경 + accent 테두리·글자로 대비를 올린다.
   0건 탭은 뷰에서 배지를 아예 렌더하지 않으므로, 숫자가 있는 탭만 시선에 걸린다. */
.tab-count {
    display: inline-flex;
    align-items: center;
    margin-left: 5px;
    padding: 1px 6px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.5;
    min-width: 18px;
    justify-content: center;
    background: var(--card);
    border: 1px solid var(--accent);
    color: var(--accent);
}

/* 활성 탭은 채움 — 현재 위치를 분명히 한다. */
.tab-count.tab-count-active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-fg);
}

.nav-item-soon {
    color: var(--text-2);
    cursor: default;
    font-size: 13px;
}

/* --- Main content --- */
.main-content {
    grid-area: main;
    padding: 24px;
    min-width: 0;
    overflow-y: auto;  /* 메인 영역만 스크롤 */
    overflow-x: hidden;
    background: var(--bg);
}

/* =========================================================
   COMPONENTS
   ========================================================= */

/* --- Card --- */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0;
    box-shadow: var(--shadow);
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-1);
}

.card-body {
    padding: 20px;
}

/* --- Stat card --- */
.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0;
    padding: 20px;
    box-shadow: var(--shadow);
}

.stat-label {
    font-size: 12px;
    color: var(--text-2);
    font-weight: 500;
    margin-bottom: 8px;
}

.stat-value {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-size: 26px;
    font-weight: 600;
    color: var(--text-1);
    line-height: 1.1;
}

.stat-delta {
    font-size: 12px;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-delta.up   { color: var(--success); }
.stat-delta.down { color: var(--danger); }

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 0;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, box-shadow 0.15s, opacity 0.15s;
    line-height: 1;
    white-space: nowrap;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
    background: var(--accent);
    color: var(--accent-fg);
    border-color: var(--accent);
}
.btn-primary:hover:not(:disabled) {
    opacity: 0.88;
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: transparent;
    color: var(--text-1);
    border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) {
    background: var(--hover);
}

.btn-ghost {
    background: transparent;
    color: var(--text-2);
    border-color: transparent;
}
.btn-ghost:hover:not(:disabled) {
    background: var(--hover);
    color: var(--text-1);
}

.btn-danger {
    background: color-mix(in srgb, var(--danger) 12%, transparent);
    color: var(--danger);
    border-color: color-mix(in srgb, var(--danger) 35%, transparent);
}
.btn-danger:hover:not(:disabled) {
    background: color-mix(in srgb, var(--danger) 20%, transparent);
}

.btn-success {
    background: color-mix(in srgb, var(--success) 12%, transparent);
    color: var(--success);
    border-color: color-mix(in srgb, var(--success) 35%, transparent);
}
.btn-success:hover:not(:disabled) {
    background: color-mix(in srgb, var(--success) 20%, transparent);
}

.btn-sm  { padding: 5px 10px; font-size: 11px; border-radius: 0; }
.btn-lg  { padding: 10px 20px; font-size: 13px; border-radius: 0; }
.btn-icon { padding: 7px; }

/* --- Form controls --- */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-2);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    font-size: 12px;
    font-family: inherit;
    background: var(--bg);
    color: var(--text-1);
    border: 1px solid var(--border);
    border-radius: 0;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    appearance: none;
}

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.form-control::placeholder { color: var(--text-2); opacity: 0.6; }

/* 2026-07-07 통합테스트 정의3(O-F11): 파일 선택 인풋의 OS 네이티브 회색 버튼을 다크 토큰에 맞춘다.
   ::file-selector-button 부분만 accent 톤 칩으로 스타일링(브라우저 기본 영어 버튼 시각 이질감 제거). */
.form-control[type="file"] { padding: 6px 12px; line-height: 1.6; }
.form-control[type="file"]::file-selector-button {
    margin-right: 10px;
    padding: 4px 12px;
    font-size: 12px;
    font-family: inherit;
    background: var(--hover);
    color: var(--text-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.form-control[type="file"]::file-selector-button:hover {
    background: var(--accent);
    color: var(--accent-fg);
    border-color: var(--accent);
}

select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a8f98' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

/* date / time 입력의 네이티브 달력 아이콘 & 팝업을 테마에 맞게 */
[data-theme="dark"] input[type="date"],
[data-theme="dark"] input[type="datetime-local"],
[data-theme="dark"] input[type="time"],
[data-theme="dark"] input[type="month"],
[data-theme="dark"] input[type="week"] {
    color-scheme: dark;
}
[data-theme="light"] input[type="date"],
[data-theme="light"] input[type="datetime-local"],
[data-theme="light"] input[type="time"],
[data-theme="light"] input[type="month"],
[data-theme="light"] input[type="week"] {
    color-scheme: light;
}

/* --- Table --- */
.table-wrap {
    overflow-x: auto;
    border-radius: 0;
    border: 1px solid var(--border);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.data-table thead th {
    padding: 10px 14px;
    text-align: left;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-1);
    background: var(--hover);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
}

.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--hover); }

.data-table td {
    padding: 11px 14px;
    color: var(--text-1);
    vertical-align: middle;
}

/* --- SKU 재고 목록 — 상품 묶음(2026-08-20) ------------------------------------
   [상품 › 재고 › SKU 재고]의 "상품별 묶기" 모드 전용. 같은 상품의 SKU 행을 하나로 묶어 보이게 한다.
   (상품당 SKU 3.1행 — 상품코드·상품명이 계속 되풀이돼 눈이 상품 단위로 끊어 읽지 못했다.)

   ⚠ 왼쪽 표시선을 accent 45% 틴트로 만들었더니 **라이트 테마에서 사실상 안 보였다**(시안 실측).
     색을 옅게 섞는 방식은 라이트에서 먼저 죽는다 → 불투명 accent + opacity 로 바꿨다. */
.stock-grp > td:first-child { position: relative; }
.stock-grp > td:first-child::before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--accent);
    opacity: .55;
}
/* 묶음 머리행 — 윗선 + 아주 옅은 틴트로 "여기서 새 상품이 시작한다"를 줄 단위로 잡게 한다. */
.stock-grp-first > td {
    border-top: 1px solid var(--border);
    background: color-mix(in srgb, var(--accent) 4%, transparent);
}
/* td 배경이 tr:hover 배경을 덮으므로 머리행 hover 는 여기서 다시 지정한다(안 하면 머리행만 hover 가 죽는다). */
.data-table tbody tr.stock-grp-first:hover > td { background: var(--hover); }

/* 목록 썸네일 — 이름이 같은 색상 변형을 눈으로 가르는 단서. 각진 것이 정본이라 radius 를 주지 않는다. */
.stock-thumb {
    width: 28px; height: 28px;
    flex: 0 0 28px;
    object-fit: cover;
    border: 1px solid var(--border);
    background: var(--hover);
}

/* --- 옵션/재고 관리 — 좌측 고정 상품 패널(2026-08-20) --------------------------
   [상품 › 옵션/재고 관리] 전용 2열 레이아웃. 왼쪽에 상품 요약·재고 지표를 붙박이로 두고
   오른쪽에서 옵션 축·SKU 격자를 편집한다(시안 C안 + B안 지표 — 사용자 선택).
   ⚠ 관리자 기준 폭 1280 에서 사이드바(180)를 빼면 본문이 ~1100 이다. 왼쪽 300 을 주고도
     SKU 격자(옵션 3축이면 열 9개)가 들어가야 하므로, 오른쪽은 min-width:0 으로 두어
     표가 자기 스크롤(.table-wrap)을 쓰게 한다 — 안 그러면 격자가 그리드를 밀어 페이지가 옆으로 넘친다. */
/* ⚠ align-items 를 건드리지 않는다(기본 stretch 유지). start 로 두면 <aside> 높이가 내용만큼으로 줄어
     그 안의 sticky 패널이 **움직일 공간이 없어 고정이 동작하지 않는다.** aside 가 행 높이만큼 늘어나야
     패널이 그 안에서 따라 내려온다. */
.opt-split { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; }
.opt-main  { min-width: 0; }

.opt-side {
    position: sticky;
    top: 12px;              /* 스크롤을 내려도 상품이 계속 보인다 — 이 패널의 존재 이유다 */
    border: 1px solid var(--border);
    background: var(--card);
    box-shadow: var(--shadow);
    max-height: calc(100vh - 88px);   /* 탑바(52)+여백. 넘치면 패널 안에서 스크롤한다 */
    overflow-y: auto;
}
.opt-side-img {
    /* 4:3 — 1:1 로 두면 300px 폭에서 세로 300px 를 먹어 아래 지표·경고가 화면 밖으로 밀린다(실측).
       상품 확인에는 이 정도로 충분하다(object-fit:cover 로 가운데를 보여준다). */
    display: block; width: 100%; aspect-ratio: 4 / 3;
    object-fit: cover;
    border-bottom: 1px solid var(--border);
    background: var(--hover);
}
.opt-side-body { padding: 13px 14px; }

.opt-side-rows { margin-top: 11px; }
.opt-side-rows > div {
    display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
    font-size: 11px; padding: 5px 0;
    border-bottom: 1px solid var(--border);
}
.opt-side-rows > div:last-child { border-bottom: none; }
.opt-side-rows > div > span:first-child { color: var(--text-3); flex: 0 0 auto; }
.opt-side-rows > div > :last-child {
    text-align: right; min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;   /* 브랜드명이 길다(예: 컬럼비아스포츠웨어코리아) */
}
.opt-side-hint { margin: 8px 0 0; font-size: 10px; color: var(--text-3); line-height: 1.5; }

/* 지표 4칸 — 패널 폭이 300 이라 2×2 로 접는다. 값은 **저장된 DB 값**이다(편집 중 흔들지 않는다). */
.opt-tiles {
    display: grid; grid-template-columns: 1fr 1fr;
    border: 1px solid var(--border);
    margin-top: 12px;
}
.opt-tile { padding: 9px 11px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.opt-tile:nth-child(2n) { border-right: none; }
.opt-tile:nth-last-child(-n+2) { border-bottom: none; }
.opt-tile .lbl { font-size: 9px; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); font-weight: 600; }
.opt-tile .val { font-size: 18px; font-weight: 800; font-family: var(--font-mono); line-height: 1; margin-top: 5px; }
.opt-tile .sub { font-size: 9px; color: var(--text-3); margin-top: 4px; }

/* 경고 — 조건부로만 그린다(항상 뜨는 경고는 아무도 읽지 않는다). */
.opt-alert {
    display: flex; flex-direction: column; gap: 3px;
    margin-top: 8px; padding: 8px 10px;
    font-size: 10.5px; line-height: 1.5; color: var(--text-1);
}
.opt-alert-danger { background: color-mix(in srgb, var(--danger) 8%, transparent); }
.opt-alert-warn   { background: color-mix(in srgb, var(--warning) 8%, transparent); }
.opt-alert .badge { align-self: flex-start; }

.opt-side-actions { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.opt-side-actions .btn { justify-content: center; }

/* 좁은 화면(관리자 최소 1280 미만)에서는 2열을 접는다 — 패널이 격자를 밀어내는 것보다 낫다. */
@media (max-width: 1180px) {
    .opt-split { grid-template-columns: 1fr; }
    .opt-side { position: static; max-height: none; }
    .opt-side-img { aspect-ratio: 16 / 6; }
}

/* --- 상품 상세 — 좌측 앵커 + 단일 스크롤 폼(2026-08-20, 시안 B안) ---------------
   탭 3개(기본정보/사이즈·재고/카테고리·태그)를 걷어내고 섹션을 한 줄로 세운 구조.
   좌측에 섹션 앵커 목록과 **입력 완성도**를 고정한다(완성도는 시안 A안에서 가져온 조각 — 사용자 지시).
   ⚠ .opt-split 과 같은 이유로 align-items 를 건드리지 않는다(기본 stretch) —
     start 로 두면 왼쪽 열 높이가 줄어 sticky 가 움직일 공간을 잃는다. */
.pd-split { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 16px; }
.pd-main  { min-width: 0; }
.pd-sec   { display: block; margin-bottom: 16px; scroll-margin-top: 60px; }  /* 앵커 점프 시 저장 바에 가리지 않게 */
.pd-sec:last-child { margin-bottom: 0; }

/* 상단 고정 저장 바 — 변경이 생기면 색이 바뀐다. 긴 폼에서 맨 아래까지 내려가 저장하지 않게 한다. */
.pd-savebar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 9px 14px; margin-bottom: 14px;
    border: 1px solid var(--border);
    background: var(--card);
    box-shadow: var(--shadow);
}
.pd-savebar.dirty {
    border-color: color-mix(in srgb, var(--warning) 60%, transparent);
    background: color-mix(in srgb, var(--warning) 8%, var(--card));
}

/* 좌측 열 — 고정은 여기 한 곳에만 건다(앵커 목록·완성도에 각각 걸면 스크롤 시 서로를 덮는다). */
.pd-side {
    position: sticky; top: 60px;   /* 저장 바(약 44) + 여백 */
    max-height: calc(100vh - 124px);
    overflow-y: auto;
}

/* 섹션 앵커 목록 */
.pd-nav {
    border: 1px solid var(--border);
    background: var(--card);
    margin-bottom: 12px;
}
.pd-nav a {
    display: flex; align-items: center; justify-content: space-between; gap: 6px;
    padding: 7px 12px;
    font-size: 11.5px; color: var(--text-2); text-decoration: none;
    border-left: 3px solid transparent;
}
.pd-nav a:hover { background: var(--hover); color: var(--text-1); }
.pd-nav a.on {
    color: var(--accent); font-weight: 600;
    border-left-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 8%, transparent);
}

/* 입력 완성도 — 채워졌는지만 알린다(경고이지 저장 차단이 아니다). 항목을 누르면 그 섹션으로 이동. */
.pd-check {
    border: 1px solid var(--border);
    background: var(--card);
}
.pd-check .h {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 12px; border-bottom: 1px solid var(--border);
    font-size: 11px; font-weight: 600;
}
.pd-check .b { padding: 6px 0; }
.pd-check .b a {
    display: flex; align-items: flex-start; gap: 7px;
    padding: 4px 12px;
    font-size: 11px; line-height: 1.5; text-decoration: none; color: var(--text-2);
}
.pd-check .b a:hover { background: var(--hover); }
.pd-check .b a .mark { flex: 0 0 auto; font-weight: 700; }
.pd-check .b a.ok .mark { color: var(--success); }
.pd-check .b a.no .mark { color: var(--warning); }
.pd-check .b a.ok { color: var(--text-3); }          /* 채워진 항목은 뒤로 물러난다 — 눈은 안 채운 것을 봐야 한다 */
.pd-check .b a.no { color: var(--text-1); }
.pd-check .b a .hint { display: block; font-size: 9.5px; color: var(--text-3); }

@media (max-width: 1180px) {
    .pd-split { grid-template-columns: 1fr; }
    .pd-side { position: static; max-height: none; }
}

/* --- Badges / Status --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-default { background: var(--hover); color: var(--text-2); }
.badge-accent  { background: var(--accent); color: var(--accent-fg); }
.badge-success { background: color-mix(in srgb, var(--success) 18%, transparent); color: var(--success); }
.badge-danger  { background: color-mix(in srgb, var(--danger)  18%, transparent); color: var(--danger); }
.badge-warning { background: color-mix(in srgb, var(--warning) 18%, transparent); color: var(--warning); }
.badge-info    { background: color-mix(in srgb, var(--info)    18%, transparent); color: var(--info); }

/* --- 주문 상태 배지 (.badge-status) ---
   currentColor 기반: span 의 인라인 color(또는 DB CodeOrderStatusColor)를 그대로 살린 채
   옅은 배경 + 테두리 + 선행 상태 점을 자동 생성한다. 어떤 상태 색이 와도 일관된 태그가 된다.
   사용: <span class="badge badge-status" style="color:#3b82f6">입금확인</span> */
.badge-status {
    background: color-mix(in srgb, currentColor 13%, transparent);
    border: 1px solid color-mix(in srgb, currentColor 30%, transparent);
    padding: 3px 8px;
    border-radius: 3px;         /* 박스형(각진) 태그 — 알약형 금지 */
    line-height: 1.2;
}
.badge-status::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;   /* 상태 색과 동일한 점 */
    margin-right: 5px;
    flex-shrink: 0;
}
/* 다크모드: 어두운 배경에서 상태 배지가 묻히지 않도록 틴트 배경/테두리를 보강.
   상태색(TB_CodeOrderStatus.CodeOrderStatusColor)을 다크/라이트 양쪽에서 잘 보이는
   mid-tone(Tailwind 400~500)으로 정리했으므로(=docs/migration/sql/update-order-status-colors.sql),
   과거의 강한 brightness 보정은 제거하고 살짝만 밝힌다.
   전 시스템 공통(.badge-status)이라 모든 주문상태에 일괄 적용. */
[data-theme="dark"] .badge-status {
    background: color-mix(in srgb, currentColor 22%, transparent);
    border-color: color-mix(in srgb, currentColor 52%, transparent);
    font-weight: 700;
    filter: brightness(1.08);
}

/* ============================================================================
   주문 4축 상태 태그 (.bw-tag + .bw-{axis}-{step})
   ----------------------------------------------------------------------------
   디자인 결정(2026-07-02): 축마다 고유 베이스색, 한 축 안에서는
   "앞(초기) 연하게 → 뒤(종결) 진하게" 명도 그라데이션.
     · 결제  로즈   #C13383  (bw-pay-1..6)
     · 배송  인디고 #443199  (bw-ship-1..4)
     · 클레임 코랄   #E05454  (bw-claim-1..5, 없음=0 중립)
     · 마감  퍼플   #792CA2  (bw-clo-1..3)
   솔리드 태그라 다크/라이트 양쪽에서 동일하게 잘 보인다(테마 무관 고정 hex).
   매핑(enum→step): Brandaweek.Core.Ordering.OrderStatusBadge
   ============================================================================ */
.bw-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: -.01em;
    white-space: nowrap;
}
/* 축별 단색 라인 아이콘(스프라이트 <use>) — 태그 글자색(currentColor)을 따라감. */
.bw-ic {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
/* 결제 (rose #C13383) — 결제대기 → 결제완료 → 부분환불 → 전액환불 → 결제실패 */
.bw-pay-1 { background: #F4DAE9; color: #87245C; }
.bw-pay-2 { background: #E7B2D0; color: #87245C; }
.bw-pay-3 { background: #D981B2; color: #ffffff; }
.bw-pay-4 { background: #C84C92; color: #ffffff; }
.bw-pay-5 { background: #AA2D73; color: #ffffff; }
.bw-pay-6 { background: #87245C; color: #ffffff; }
/* 배송 (indigo #443199) — 미발송 → 상품준비중 → 배송중 → 배송완료 (2026-07-05 재정의) */
.bw-ship-1 { background: #DAD6EB; color: #33256E; }
.bw-ship-2 { background: #A59CCE; color: #241A55; }
.bw-ship-3 { background: #7162B2; color: #ffffff; }
.bw-ship-4 { background: #443199; color: #ffffff; }
/* 클레임 (coral #E05454) — 접수 → 회수승인 → 회수수거중 → 완료 → 거부 (없음=중립) */
.bw-claim-0 { background: var(--hover); color: var(--text-2); }
.bw-claim-1 { background: #F6CFCF; color: #9A2B2B; }
.bw-claim-2 { background: #EFA6A6; color: #9A2B2B; }
.bw-claim-3 { background: #E77A7A; color: #ffffff; }
.bw-claim-4 { background: #CA4C4C; color: #ffffff; }
.bw-claim-5 { background: #923737; color: #ffffff; }
/* 마감 (purple #792CA2) — 진행중 → 구매확정 → 종료 */
.bw-clo-1 { background: #DCC8E7; color: #5A2079; }
.bw-clo-2 { background: #AC7CC5; color: #ffffff; }
.bw-clo-3 { background: #792CA2; color: #ffffff; }

/* --- 주문 헤더 밴드 (.order-band) ---
   주문 단위(상위 엔티티)를 상품 행(하위)과 한눈에 구분하기 위한 색상 밴드.
   직관적 색상: info(블루) 톤의 옅은 배경 + 좌측 3px 인디케이터.
   카드 묶음형 목록의 카드 헤더, 주문상세의 '주문자 정보' 카드 헤더에 공통 적용.
   color-mix 로 다크/라이트 테마 모두에서 카드 배경과 자연스럽게 섞인다. */
.order-band {
    background: color-mix(in srgb, var(--info) 10%, var(--card)) !important;
    border-left: 3px solid var(--info);
}
/* 다크모드: 카드 배경이 어두워 10% 틴트가 거의 안 보임 → 틴트를 더 진하게 + 좌측 바 강조 */
[data-theme="dark"] .order-band {
    background: color-mix(in srgb, var(--info) 22%, var(--card)) !important;
    border-left-width: 4px;
}

/* --- 기간 프리셋 버튼 (.date-presets) — 달력 옆 [오늘][1주일]...[1년] --- */
.date-presets {
    display: inline-flex;
    gap: 4px;
    flex-wrap: wrap;
    align-items: center;
    margin-left: 6px;
}
.date-presets button {
    font-size: 11px;
    line-height: 1;
    padding: 6px 9px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text-2);
    border-radius: var(--radius-sm);
    cursor: pointer;
    white-space: nowrap;
    transition: all .12s;
}
.date-presets button:hover {
    border-color: var(--accent);
    color: var(--text-1);
}
.date-presets button.active {
    background: var(--accent);
    color: var(--accent-fg);
    border-color: var(--accent);
    font-weight: 600;
}

/* --- Tabs --- */
.tab-list {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
    overflow-x: auto;
    scrollbar-width: none;
}
.tab-list::-webkit-scrollbar { display: none; }

.tab-btn, .tab-item {
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-2);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
    margin-bottom: -1px;
    text-decoration: none;
    display: inline-block;
}

.tab-btn:hover, .tab-item:hover { color: var(--text-1); }

.tab-btn.active, .tab-item.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: 600;
}

[data-theme="light"] .tab-btn.active,
[data-theme="light"] .tab-item.active { color: var(--accent); }

/* --- Modal --- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(2px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0;
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 560px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    animation: modal-in 0.18s ease;
}

@keyframes modal-in {
    from { opacity: 0; transform: scale(0.96) translateY(-8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 15px;
    font-weight: 600;
    flex-shrink: 0;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-shrink: 0;
}

/* --- Slide panel (right drawer) --- */
.slide-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 480px;
    max-width: 95vw;
    height: 100vh;
    background: var(--card);
    border-left: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.22s ease;
}

.slide-panel.open { transform: translateX(0); }

.slide-panel-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 15px;
    font-weight: 600;
    flex-shrink: 0;
}

/*
  2026-08-25 — 드로워 안의 <form> 을 **flex 컬럼으로 승격**한다.

  왜 필요한가(실측 재현):
    .slide-panel 은 height:100vh 의 flex 컬럼이고 .slide-panel-body 가 flex:1 + overflow-y:auto 로
    "남는 높이를 먹고 스크롤"하도록 설계됐다. 그런데 드로워 3개(FrontSections·CouponsV2·_GradeDrawer)는
    구조가 `.slide-panel > form > (header/body/footer)` 라 **body 의 부모가 form** 이다.
    form 은 flex 컨테이너가 아니므로 자식의 flex:1 이 **아무 효과가 없고**, body 가 내용 전체 높이로
    늘어나 하단 [저장] 버튼이 패널 밖으로 밀린다. .slide-panel 에는 overflow 가 없어
    **스크롤로도 닿을 수 없다** — 즉 저장이 불가능해진다.

    실측(1600×760): 저장버튼 y=839(패널 높이 760 밖) · body scrollHeight=clientHeight=768(스크롤 안 됨).
    화면이 세로로 길면 우연히 보이므로(1600×900 에선 y=839 로 간신히 보인다) 발견이 늦었다.

  min-height:0 이 함께 필요한 이유: flex 아이템의 기본 min-height 는 auto 라 내용보다 작아지지 않는다.
  0 으로 낮춰야 body 가 실제로 줄어들며 overflow-y:auto 가 스크롤을 만든다.

  ⚠ .slide-panel > form 만 겨냥한다(자식 결합자). 드로워 안쪽의 다른 form(필터·인라인 저장 등)까지
    flex 로 바꾸면 그 폼들의 레이아웃이 깨진다.
*/
.slide-panel > form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.slide-panel-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;   /* 위 주석 참고 — 없으면 flex:1 이 있어도 줄어들지 않아 스크롤이 생기지 않는다 */
}

/* --- Toast notifications --- */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0;
    box-shadow: var(--shadow-lg);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-1);
    pointer-events: all;
    animation: toast-in 0.2s ease;
    min-width: 260px;
    max-width: 360px;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.danger  { border-left: 3px solid var(--danger); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast.info    { border-left: 3px solid var(--info); }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* --- Pagination --- */
.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.page-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 500;
    border-radius: 0;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-2);
    cursor: pointer;
    transition: background 0.1s, color 0.1s;
    text-decoration: none;
}

.page-btn:hover:not(:disabled):not(.active) {
    background: var(--hover);
    color: var(--text-1);
}

.page-btn.active {
    background: var(--accent);
    color: var(--accent-fg);
    border-color: var(--accent);
}

.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* --- Search toolbar --- */
.search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--card);
}

.search-input-wrap {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.search-input-wrap .search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    color: var(--text-2);
    pointer-events: none;
}

.search-input-wrap .form-control {
    padding-left: 32px;
}

/* --- Page header --- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

/* title + subtitle 같은 줄 배치 */
.page-header > div:first-child {
    display: flex;
    align-items: flex-end;
    gap: 0;
}

/* 우측 액션 버튼 그룹 — flex + 세로 중앙정렬(gap 8px).
   미정의 시 plain block 이라 버튼들이 인라인 baseline 정렬돼 <a>(인쇄) 와 <button> 가
   2px 어긋났다(2026-07-18 수정). 세로 중앙정렬로 버튼 종류(a/button)와 무관하게 정렬 통일. */
.page-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.page-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-1);
    letter-spacing: -0.025em;
    line-height: 1;
}

.page-subtitle {
    font-size: 10px;
    color: var(--text-2);
    margin-top: 0;
    margin-left: 10px;
    padding-left: 10px;
    border-left: 1px solid var(--border);
}

/* --- Grid utils --- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* --- Divider --- */
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* --- Mono number --- */
.mono {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-size: 0.95em;
}

/* --- HTMX loading indicator --- */
.htmx-indicator {
    display: none;
}
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
    display: inline-flex;
}

/* Spinner */
.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* =========================================================
   GNB (Global Navigation Bar) — 탑바 내 1차 메뉴
   ========================================================= */

.gnb-nav {
    display: flex;
    align-items: center;
    height: 52px;
    gap: 2px;
    padding-left: 6px;
    overflow: hidden;  /* GNB 항목이 많아도 topbar 밖으로 넘치지 않게 */
    min-width: 0;
    flex-shrink: 1;
}

.gnb-item {
    display: inline-flex;
    align-items: center;
    height: 52px;
    padding: 0 12px;
    font-size: 13px;
    font-weight: 800;   /* 2026-07-03: 사용자 요청 "아주 두꺼운 볼드체" — 500(중간)→800(엑스트라볼드) */
    color: var(--nav-text);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.15s;
}

.gnb-item:hover { color: var(--text-1); }

.gnb-item.active {
    color: var(--text-1);
    font-weight: 900;   /* 활성 항목은 최대 굵기(블랙)로 한 단계 더 강조 */
    border-bottom-color: var(--accent);
}

/* =========================================================
   SIDEBAR COLLAPSE
   ========================================================= */

/* Collapsed state: sidebar narrows to icon-only 56px */
.admin-layout.sidebar-collapsed {
    grid-template-columns: 56px 1fr;
}

.admin-layout.sidebar-collapsed .sidebar {
    width: 56px;
    overflow: hidden;
}

/* Hide text labels + section titles when collapsed */
.admin-layout.sidebar-collapsed .nav-item span,
.admin-layout.sidebar-collapsed .nav-section-label {
    display: none;
}

/* Center icons when collapsed */
.admin-layout.sidebar-collapsed .nav-item {
    padding: 10px 0;
    justify-content: center;
    margin: 1px 6px;
    border-radius: 0;
}

/* Hide left indicator bar when collapsed */
.admin-layout.sidebar-collapsed .nav-item.active::before {
    display: none;
}

/* Tooltip on hover when collapsed */
.admin-layout.sidebar-collapsed .nav-item {
    position: relative;
}

.admin-layout.sidebar-collapsed .nav-item::after {
    content: attr(data-label);
    position: absolute;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text-1);
    font-size: 12px;
    font-weight: 500;
    padding: 5px 10px;
    border-radius: 0;
    white-space: nowrap;
    box-shadow: var(--shadow);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 50;
}

.admin-layout.sidebar-collapsed .nav-item:hover::after {
    opacity: 1;
}

/* Toggle button */
.sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 0;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-2);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background: var(--hover);
    color: var(--text-1);
}

.sidebar-toggle svg {
    width: 16px;
    height: 16px;
    transition: transform 0.2s;
}

.admin-layout.sidebar-collapsed .sidebar-toggle svg {
    transform: rotate(180deg);
}

/* Smooth transition */
.admin-layout, .sidebar {
    transition: grid-template-columns 0.2s ease, width 0.2s ease;
}

/* =========================================================
   LOGIN PAGE
   ========================================================= */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
}

.login-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0;
    padding: 40px;
    width: 100%;
    max-width: 380px;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    font-size: 22px;
    font-weight: 800;
    text-align: center;
    margin-bottom: 6px;
    letter-spacing: -0.5px;
}

.login-sub {
    text-align: center;
    font-size: 12px;
    color: var(--text-2);
    margin-bottom: 28px;
}

/* =========================================================
   UTILITY OVERRIDES (non-Tailwind)
   ========================================================= */

.text-1 { color: var(--text-1); }
.text-2 { color: var(--text-2); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-info    { color: var(--info); }

.bg-card   { background: var(--card); }
.bg-hover  { background: var(--hover); }
.bg-accent { background: var(--accent); }

.border-base { border: 1px solid var(--border); }
.rounded-base { border-radius: 0; }

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    border: 0;
}

/* ── Quill HTML Editor ─────────────────────────────────────── */
.ql-toolbar.ql-snow {
    background: var(--hover);
    border: 1px solid var(--border);
    border-radius: 0;
}
.ql-container.ql-snow {
    border: 1px solid var(--border);
    border-top: none;
}
.ql-editor {
    color: var(--text-1);
    background: var(--bg);
    font-size: 13px;
    line-height: 1.7;
    min-height: 180px;
}
.ql-editor.ql-blank::before { color: var(--text-2); font-style: normal; }
.ql-snow .ql-stroke { stroke: var(--text-2); }
.ql-snow .ql-fill  { fill:   var(--text-2); }
.ql-snow .ql-picker { color: var(--text-2); }
.ql-snow .ql-picker-options {
    background: var(--card);
    border: 1px solid var(--border);
}
.ql-snow .ql-picker-item:hover,
.ql-snow .ql-picker-item.ql-selected { color: var(--text-1); }
.ql-snow.ql-toolbar button:hover .ql-stroke,
.ql-snow .ql-toolbar button:hover .ql-stroke,
.ql-snow.ql-toolbar button.ql-active .ql-stroke,
.ql-snow .ql-toolbar button.ql-active .ql-stroke { stroke: var(--accent); }
.ql-snow.ql-toolbar button:hover .ql-fill,
.ql-snow .ql-toolbar button.ql-active .ql-fill { fill: var(--accent); }

/* 리스트 표의 날짜/시간·코드 셀이 두 줄로 접히지 않도록 기본 한 줄. 넓은 표는 .table-wrap(overflow-x:auto)가 가로 스크롤.
   (긴 텍스트 셀에서 줄바꿈이 필요하면 해당 셀에 style="white-space:normal" 로 개별 허용) */
.data-table th, .data-table td { white-space: nowrap; }

/* 컬럼이 많은 표(주문·상품목록 등)는 .wrap 을 붙여 셀 줄바꿈 허용(날짜 2줄 등). */
.data-table.wrap th, .data-table.wrap td { white-space: normal; }

/* ── CS메모 (2026-07-18) ─────────────────────────────────────────────
   목록 카드의 CS 번호 배지 버튼 + 우측 슬라이드 드로어. 상세의 .od-drawer 와 별개 클래스로
   분리(목록 전용) — 여러 주문 목록에 동일하게 재사용한다. */
/* ⚠ 2026-08-19 각지게 수정 — 종전 border-radius:10px(알약형)이었다.
   "관리자 내 모든 액션 버튼은 박스로"(사용자 지시). 알약형은 **배지(읽는 것)의 모양**이라,
   누르는 버튼이 알약이면 상태 배지와 같은 물건으로 읽힌다(같은 날 정리한 '상태 vs 액션' 규칙).
   숫자 배지(.cs-memo-count)는 배지이므로 둥근 채로 둔다. */
.cs-memo-btn {
    position: relative; display: inline-flex; align-items: center; gap: 4px;
    height: 20px; padding: 0 9px; border: 1px solid var(--border); border-radius: 0;
    background: var(--card); color: var(--text-2); font-size: 10px; font-weight: 700;
    cursor: pointer; line-height: 1;
}
.cs-memo-btn:hover { border-color: var(--accent); color: var(--accent); }
.cs-memo-btn svg { width: 11px; height: 11px; }
/* 번호 배지 — 우상단 알림형(있을 때만). 강조를 위해 빨강(danger) + 카드색 링. */
.cs-memo-count {
    position: absolute; top: -7px; right: -7px; min-width: 16px; height: 16px; padding: 0 4px;
    border-radius: 8px; background: var(--danger); color: #fff;
    font-size: 9px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; line-height: 1;
    box-shadow: 0 0 0 2px var(--card);
}

.cs-drawer-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); backdrop-filter: blur(2px); z-index: 1000; }
.cs-drawer {
    position: fixed; top: 0; right: 0; height: 100vh; width: 460px; max-width: 92vw;
    background: var(--card); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg);
    z-index: 1001; transform: translateX(100%); transition: transform .22s ease; display: flex; flex-direction: column;
}
.cs-drawer.open { transform: translateX(0); }
.cs-drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.cs-drawer-body { padding: 20px; overflow-y: auto; }

/* 고시 입력 3분기 토글 (2026-08-26) — 직접입력 / 상품상세 참조 / 법령 준용
   각진 플랫이 정본이라 border-radius 를 넣지 않는다(--radius:0). */
.seg { display:inline-flex; border:1px solid var(--border); }
.seg button { padding:5px 9px; font-size:10px; font-weight:600; background:transparent;
              color:var(--text-2); border:0; border-left:1px solid var(--border);
              cursor:pointer; font-family:inherit; white-space:nowrap; }
.seg button:first-child { border-left:0; }
.seg button:hover { background:var(--hover); color:var(--text-1); }
.seg button.on { background:var(--accent); color:var(--accent-fg); }
