﻿/*
 * Gemini Version - Modern Light/Clean Design
 * EZ-M v1.0.1 - Refined Reinterpretation
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700&family=Montserrat:wght@800&display=swap');

:root {
/* ... 기존 내용 유지 ... */
    /* Color Palette - Clean & Bright */
    --bg-main: #f1f5f9;
    --bg-panel: #ffffff;
    --bg-sidebar: #1e293b; /* 사이드바는 가독성을 위해 어두운 톤 유지 */
    --primary: #2563eb;
    --primary-light: rgba(37, 99, 235, 0.1);
    --secondary: #7c3aed;
    --accent: #f59e0b;
    --success: #10b981;
    --danger: #ef4444;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --card-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    
    /* Spacing & Rounds */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --transition: all 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
}

#app {
    display: flex;
    width: 100%;
    height: calc(100vh - 28px);
}

.app-status-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1300;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    padding: 0 14px;
    border-top: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #475569;
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 -2px 6px rgba(15, 23, 42, 0.06);
}

.app-status-left,
.app-status-right {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.app-status-left {
    flex: 0 1 auto;
    justify-content: flex-end;
}

.app-status-right {
    flex: 0 0 auto;
    color: #64748b;
    font-variant-numeric: tabular-nums;
    margin-left: 12px;
    padding-left: 14px;
    border-left: 1px solid #cbd5e1;
}

.app-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #94a3b8;
    box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.14);
}

.app-status-dot.busy {
    background: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.app-status-dot.ok {
    background: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.16);
}

.app-status-dot.slow {
    background: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18);
}

.app-status-dot.error {
    background: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.16);
}

.app-status-state {
    flex: 0 0 auto;
    color: #334155;
    font-weight: 900;
}

.app-status-message {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-status-duration {
    min-width: 54px;
    color: #0f172a;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.app-status-clock-label {
    color: #94a3b8;
    font-weight: 800;
}

.app-status-clock {
    min-width: 62px;
    color: #334155;
    font-weight: 900;
    text-align: right;
}

/* --- 로그인 화면 --- */
#login-overlay {
    position: fixed;
    inset: 0;
    background: rgba(241, 245, 249, 0.9);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.login-card {
    background: white;
    padding: 40px;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    border: 1px solid var(--border);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header .brand {
    font-size: 34px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.5px;
    margin-bottom: 8px;
    font-family: 'Outfit', sans-serif;
}

.login-header .brand span {
    font-family: 'Montserrat', sans-serif;
    color: #0f172a;
    font-weight: 800;
    margin-right: 15px;
    letter-spacing: -1px;
}

.login-header p {
    color: var(--text-muted);
    font-size: 14px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.input-group input {
    width: 100%;
    padding: 12px 16px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    outline: none;
    transition: var(--transition);
}

.input-group input:focus {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px var(--primary-light);
}

.error-msg {
    color: var(--danger);
    font-size: 12px;
    margin-bottom: 16px;
    margin-bottom: 16px;
    text-align: center;
}

/* 필터 바 추가 스타일 */
.filter-sep {
    width: 1px;
    height: 24px;
    background: rgba(255,255,255,0.1);
    margin: 0 10px;
}

.filter-input {
    background: #f8fafc; /* 밝은 배경 */
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    color: #1e293b; /* 어두운 글자 */
    padding: 7px 12px;
    font-size: 13px;
    outline: none;
    width: 180px;
    transition: all 0.2s;
}

.filter-input:focus {
    border-color: #3b82f6;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* --- 사이드바 (세련된 다크 네이비) --- */
#sidebar {
    width: 210px;
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    z-index: 100;
    border-right: 1px solid rgba(255,255,255,0.06);
    box-shadow: 4px 0 20px rgba(0,0,0,0.12);
}

.sidebar-header {
    padding: 22px 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 8px;
}

.sidebar-header .brand {
    font-family: 'Outfit', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.5px;
}

.sidebar-header .brand span {
    font-family: 'Montserrat', sans-serif;
    color: #60a5fa;
    font-weight: 800;
    margin-right: 6px;
}

.nav-group {
    margin-bottom: 4px;
    padding: 0 8px;
}

/* 대분류: 좌측 강조 스타일 */
.nav-label {
    font-size: 14px; /* 11px -> 14px 확대 */
    font-weight: 800;
    color: #f8fafc; /* 더 밝고 명확하게 */
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin: 18px 0 6px;
    padding: 0 8px;
    cursor: default;
}

/* 중분류: 컴팩트한 리스트 */
.nav-item {
    display: flex;
    align-items: center;
    padding: 7px 10px;
    color: #94a3b8;
    text-decoration: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-bottom: 1px;
    font-size: 13px;
    border-left: 2px solid transparent;
}

.nav-item:hover:not(.disabled) {
    background: rgba(255,255,255,0.07);
    color: #cbd5e1;
    border-left-color: rgba(96,165,250,0.4);
    padding-left: 14px;
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(37,99,235,0.25), rgba(37,99,235,0.08));
    color: #93c5fd;
    font-weight: 600;
    border-left: 2px solid #3b82f6;
    padding-left: 14px;
}

/* 비활성 메뉴 스타일 */
.nav-item.disabled {
    color: #94a3b8; /* 일반 메뉴와 동일하게 */
    cursor: not-allowed;
    opacity: 1; /* 투명도 제거 */
}

.nav-item.disabled:hover {
    background: transparent;
}

/* --- 메인 콘텐츠 --- */
#main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 24px;
    gap: 16px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(37, 99, 235, 0.08);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.header-logout-btn {
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #ffffff;
    color: #475569;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.header-logout-btn:hover {
    background: #f8fafc;
    color: #0f172a;
    border-color: #cbd5e1;
}

.page-title h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 26px;
    font-weight: 600;
    color: #0f172a;
}

.page-title p {
    display: none;
}

/* --- 툴바 & 필터 --- */
.toolbar {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--card-shadow);
}

.toolbar-wrap {
    flex-wrap: wrap;
    align-items: flex-end;
}

.toolbar-stack {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
}

.toolbar-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
}

.toolbar-row-actions {
    justify-content: flex-start;
}

.btn-memo-add {
    margin-left: 14px;
}

.status-filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 30px;
}

.status-filter-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-muted);
    white-space: nowrap;
}

.status-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #ffffff;
    color: #0f172a;
    font-size: 12px;
    font-weight: 700;
    user-select: none;
    cursor: pointer;
}

.status-check input {
    margin: 0;
    accent-color: #0f172a;
}

.status-check-healthy {
    color: #0f172a;
}

.status-check-caution {
    color: #b45309;
}

.status-check-warning {
    color: #dc2626;
}

#btn-refresh-unpaid {
    margin-left: 6px;
}

.toolbar-row-filters {
    padding-top: 2px;
}

.completed-filter-row {
    justify-content: center;
    flex-wrap: nowrap;
    overflow: hidden;
}

.completed-filter-row .filter-group {
    flex: 0 0 auto;
    min-width: 0;
}

.completed-filter-row .filter-group select {
    width: 118px;
    min-width: 118px;
    max-width: 118px;
}

#completed-filter-pn {
    width: 170px;
    min-width: 170px;
    max-width: 170px;
}

#completed-filter-customer,
#completed-filter-app {
    width: 140px;
    min-width: 140px;
    max-width: 140px;
}

.completed-pn-search-group {
    min-width: 260px;
}

.completed-pn-search-group .filter-input {
    width: 170px;
    min-width: 170px;
    max-width: 170px;
}

.toolbar-row-period {
    justify-content: flex-start;
}

.quick-range-group {
    min-width: 260px;
}

.quick-range-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.quick-range-btn {
    min-width: 78px;
    justify-content: center;
}

.quick-range-btn.active {
    background: #cbd5e1;
    color: #0f172a;
    border: 1px solid #94a3b8;
}

.quick-range-btn.active:hover {
    background: #cbd5e1;
    transform: none;
}

.page {
    display: none;
    flex: 1;
    overflow: hidden;
    gap: 20px;
    flex-direction: column;
}

.page.active {
    display: flex;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-input-group {
    min-width: 220px;
}

.search-input-group .filter-input {
    min-width: 220px;
}

.filter-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

select, input[type="date"] {
    background: #f8fafc;
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    outline: none;
    transition: var(--transition);
}

select:focus {
    border-color: var(--primary);
    background: white;
}

.btn {
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
}

/* --- 대시보드 통합 상단 영역 --- */
.summary-row {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
}

.summary-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.summary-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 700;
    letter-spacing: 0.3px;
}

.summary-card strong {
    font-family: 'Outfit', sans-serif;
    font-size: 24px;
    color: #0f172a;
}

/* 통합 요약 카드 */
.unified-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--card-shadow);
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stat-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.stat-value {
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
}

.stat-item.primary .stat-value { color: var(--primary); }
.stat-item.danger .stat-value { color: var(--danger); }

.stat-divider {
    width: 1px;
    height: 28px;
    background: var(--border);
}

/* 메모 패널 (제목행 삭제 및 공간 최적화) */
.memo-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    box-shadow: var(--card-shadow);
    overflow: hidden;
    min-height: 92px;
}

.memo-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.memo-item {
    background: transparent;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    border-left: 2px solid #e2e8f0;
    transition: background 0.1s;
}

.memo-item:hover {
    background: #f1f5f9;
}

.memo-meta {
    font-size: 10px;
    color: var(--text-muted);
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
}

.memo-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 11px;
    margin-top: 12px;
}

.memo-input-group {
    padding: 6px 10px;
    background: white;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 6px;
    align-items: center;
}

#input-memo {
    flex: 1;
    padding: 7px 12px;
    font-size: 11px;
    border: 1px solid var(--border);
    border-radius: 8px;
    outline: none;
    background: #f1f5f9;
}

#input-memo:focus {
    border-color: var(--primary);
    background: white;
}

#input-memo:focus {
    border-color: var(--primary);
}

.btn-sm {
    padding: 4px 10px;
    font-size: 11px;
}

/* --- 데이터 그리드 --- */
.grid-container {
    flex: 1;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--card-shadow);
}

.section-header {
    padding: 12px 20px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
}

.section-title {
    font-weight: 600;
    font-size: 13px;
    color: #334155;
    flex-shrink: 0;
}

.section-summary {
    font-size: 13px;
    color: #334155;
    font-weight: 600;
    margin-left: 160px;
    flex: 0 1 auto;
    width: fit-content;
    max-width: calc(100% - 140px);
    padding: 6px 12px;
    border-radius: 14px;
    background: #fef3c7;
    border: 1px solid #fde68a;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 8px;
}

.summary-empty {
    color: #64748b;
    font-weight: 600;
}

.summary-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 84px;
    font-size: 13px;
    color: #334155;
    font-weight: 600;
}

.summary-chip-pn {
    color: #2563eb;
    font-weight: 800;
}

.summary-chip-excess {
    color: #0f172a;
    font-weight: 800;
}

.summary-chip-excess.negative {
    color: #dc2626;
}

.summary-two-line {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.summary-row-labels,
.summary-row-values {
    display: grid;
    grid-template-columns: repeat(5, minmax(84px, auto));
    justify-content: start;
    gap: 10px;
}

.summary-row-labels .summary-chip {
    color: #64748b;
    font-size: 12px;
    font-weight: 600;
}

.summary-row-values .summary-chip {
    font-size: 14px;
    font-weight: 700;
}

.completed-grid-container {
    min-height: 320px;
}

.table-wrap {
    flex: 1;
    overflow: auto;
}

table {
    width: 100%;
    min-width: 1400px;
    border-collapse: collapse;
    font-size: 13px; /* 12px -> 13px로 확대 */
}

#main-grid th:nth-child(2),
#main-grid td:nth-child(2) {
    width: 130px;
    max-width: 130px;
}

#main-grid th:nth-child(3),
#main-grid td:nth-child(3) {
    width: 187px;
    max-width: 187px;
}

#main-grid th:nth-child(10),
#main-grid td:nth-child(10),
#main-grid th:nth-child(11),
#main-grid td:nth-child(11) {
    width: 141px;
    max-width: 141px;
}

#main-grid th:nth-child(12),
#main-grid td:nth-child(12) {
    width: 130px;
    max-width: 130px;
}

#main-grid td:nth-child(2),
#main-grid td:nth-child(10),
#main-grid td:nth-child(11),
#main-grid td:nth-child(12) {
    overflow: hidden;
    text-overflow: ellipsis;
}

#wip-grid th:nth-child(1),
#wip-grid td:nth-child(1) {
    width: 126px;
    max-width: 126px;
}

#wip-grid th:nth-child(4),
#wip-grid td:nth-child(4) {
    width: 116px;
    max-width: 116px;
}

#wip-grid th:nth-child(6),
#wip-grid td:nth-child(6),
#wip-grid th:nth-child(7),
#wip-grid td:nth-child(7) {
    width: 78px;
    max-width: 78px;
}

thead {
    position: sticky;
    top: 0;
    background: #f8fafc;
    z-index: 10;
}

th {
    text-align: left;
    padding: 10px 12px;
    color: var(--text-muted);
    font-weight: 700; /* 굵게 */
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    font-size: 13px; /* 12px -> 13px로 확대 */
    letter-spacing: 0.5px;
    white-space: nowrap;
}

td {
    padding: 8px 12px;
    border-bottom: 1px solid #f1f5f9;
    white-space: nowrap;
    font-size: 13px; /* 명시적 크기 지정 */
}

tbody tr:hover {
    background: #f8fafc;
}

tbody tr.selected {
    background: var(--primary-light);
}

.pn-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pn-text {
    font-weight: 700;
    color: var(--primary);
}

.memo-indicator {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #fef3c7;
    color: #92400e;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    cursor: help;
    flex-shrink: 0;
}

.memo-indicator::after {
    content: attr(data-memo-preview);
    position: absolute;
    left: 0;
    top: calc(100% + 8px);
    min-width: 240px;
    max-width: 360px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.96);
    color: #f8fafc;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.5;
    white-space: pre-line;
    box-shadow: 0 18px 32px rgba(15, 23, 42, 0.24);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-4px);
    transition: opacity 0.16s ease, transform 0.16s ease;
    z-index: 20;
}

.memo-indicator:hover::after {
    opacity: 1;
    transform: translateY(0);
}

.num-cell {
    text-align: right;
}

.emphasis-cell {
    font-weight: 700;
    background: rgba(15, 118, 110, 0.06);
}

.empty-cell {
    text-align: center;
    padding: 72px;
    color: var(--text-muted);
}

.empty-cell.small {
    padding: 36px;
}

/* 하단 상세 영역 */
.bottom-area {
    height: 244px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.sub-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--card-shadow);
}

.completed-detail-panel {
    height: 290px;
    min-height: 290px;
    max-height: 290px;
}

#completed-main-grid .sale-type-cell,
#completed-detail-grid .sale-type-cell {
    color: #0d9488 !important;
    font-weight: 700 !important;
}

#completed-main-grid,
#completed-detail-grid {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
}

#completed-main-grid th,
#completed-main-grid td,
#completed-detail-grid th,
#completed-detail-grid td {
    white-space: nowrap !important;
    word-break: keep-all;
    padding: 9px 14px !important;
    overflow: hidden;
    text-overflow: ellipsis;
}

#completed-main-grid th:nth-child(1),
#completed-main-grid td:nth-child(1),
#completed-detail-grid th:nth-child(1),
#completed-detail-grid td:nth-child(1) {
    min-width: 108px;
}

#completed-main-grid th:nth-child(2),
#completed-main-grid td:nth-child(2),
#completed-detail-grid th:nth-child(2),
#completed-detail-grid td:nth-child(2) {
    min-width: 170px;
}

#completed-main-grid th:nth-child(3),
#completed-main-grid td:nth-child(3),
#completed-detail-grid th:nth-child(3),
#completed-detail-grid td:nth-child(3) {
    min-width: 96px;
}

#completed-main-grid th:nth-child(4),
#completed-main-grid td:nth-child(4),
#completed-main-grid th:nth-child(5),
#completed-main-grid td:nth-child(5),
#completed-main-grid th:nth-child(6),
#completed-main-grid td:nth-child(6),
#completed-detail-grid th:nth-child(4),
#completed-detail-grid td:nth-child(4),
#completed-detail-grid th:nth-child(5),
#completed-detail-grid td:nth-child(5),
#completed-detail-grid th:nth-child(6),
#completed-detail-grid td:nth-child(6) {
    min-width: 96px;
}

#completed-main-grid th:nth-child(7),
#completed-main-grid td:nth-child(7),
#completed-detail-grid th:nth-child(7),
#completed-detail-grid td:nth-child(7) {
    min-width: 110px;
}

#completed-main-grid th:nth-child(8),
#completed-main-grid td:nth-child(8),
#completed-detail-grid th:nth-child(8),
#completed-detail-grid td:nth-child(8) {
    min-width: 160px;
}

#completed-main-grid th:nth-child(9),
#completed-main-grid td:nth-child(9),
#completed-detail-grid th:nth-child(9),
#completed-detail-grid td:nth-child(9) {
    min-width: 160px;
}

#completed-main-grid th:nth-child(10),
#completed-main-grid td:nth-child(10) {
    min-width: 110px;
}

#completed-detail-grid th:nth-child(10),
#completed-detail-grid td:nth-child(10),
#completed-detail-grid th:nth-child(11),
#completed-detail-grid td:nth-child(11),
#completed-detail-grid th:nth-child(12),
#completed-detail-grid td:nth-child(12) {
    min-width: 116px;
}

.panel-header {
    padding: 12px 20px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-title {
    font-weight: 600;
    font-size: 13px;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* 하단 상세 영역 스타일링 */
.panel-summary {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    background: #ffffff;
    padding: 3px 10px;
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.02);
}

.panel-summary span {
    color: var(--primary);
    font-weight: 700;
    margin: 0 1px;
}

.sub-panel table {
    min-width: 0 !important;
    width: 100%;
    table-layout: fixed;
    font-size: 11.5px; /* 10.5px -> 11.5px로 상향 */
}

.sub-panel th, .sub-panel td {
    padding: 10px 4px !important; /* 상하 패딩 늘려 행 높이 확보 */
    text-align: center;
    white-space: normal !important;
    word-break: break-all;
    line-height: 1.4;
}

.sub-panel td[style*="text-align: right"] {
    text-align: right !important;
}

.badge-step {
    background: #f1f5f9;
    color: var(--secondary);
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 10px;
    display: inline-block;
}

/* 스크롤바 커스텀 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.btn-success {
    background: #d97706;
    color: white;
}

.btn-success:hover {
    background: #b45309;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #e2e8f0;
    color: #0f172a;
}

.btn-secondary:hover {
    background: #cbd5e1;
}

.btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
}

.sidebar-actions {
    margin-top: auto;
    padding-bottom: 16px;
}

.sidebar-meta {
    margin: 12px 12px 0;
    padding: 10px 0 0;
    border-top: 1px solid rgba(255,255,255,0.08);
    color: #94a3b8;
    font-size: 11px;
    line-height: 1.5;
}

#app-version-text {
    cursor: pointer;
    text-decoration: underline;
    text-decoration-color: rgba(148, 163, 184, 0.45);
    text-underline-offset: 3px;
}

#app-version-text:hover {
    color: #cbd5e1;
    text-decoration-color: #cbd5e1;
}

.sidebar-action-btn {
    width: 100%;
    margin-top: 10px;
    padding: 11px 12px;
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 8px;
    background: rgba(255,255,255,0.04);
    color: #e2e8f0;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.sidebar-action-btn:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.22);
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.48);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1200;
    padding: 24px;
}

.modal-card {
    width: 100%;
    max-width: 460px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: 0 30px 60px rgba(15, 23, 42, 0.24);
    padding: 24px;
}

.modal-card-lg {
    max-width: 760px;
}

.memo-modal-content {
    min-height: 280px;
    max-height: 420px;
    overflow-y: auto;
    padding: 4px 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.memo-input-group-modal {
    margin-top: 12px;
    padding: 0;
    border-top: none;
    background: transparent;
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.modal-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 24px;
    color: #0f172a;
    margin-bottom: 6px;
}

.modal-header p {
    color: var(--text-muted);
    font-size: 13px;
}

.modal-close {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #f8fafc;
    color: #475569;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.modal-close:hover {
    background: #eef2ff;
    color: var(--primary);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 8px;
}

.release-notes-list {
    margin: 0;
    padding-left: 20px;
    color: #0f172a;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.7;
}

.form-msg {
    min-height: 18px;
    margin: 8px 0 4px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
}

.form-msg.ok {
    color: var(--success);
}

.form-msg.err {
    color: var(--danger);
}

#toast-container {
    position: fixed;
    right: 20px;
    bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1400;
}

.toast {
    min-width: 240px;
    max-width: 360px;
    padding: 12px 14px;
    border-radius: 12px;
    color: white;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 16px 30px rgba(15, 23, 42, 0.18);
}

.toast.info {
    background: #334155;
}

.toast.success {
    background: #059669;
}

.toast.warning {
    background: #d97706;
}

@media (max-width: 1400px) {
    .bottom-area,
    .summary-row {
        grid-template-columns: 1fr;
        height: auto;
    }

    .toolbar-row {
        align-items: stretch;
    }

    .btn-memo-add {
        margin-left: 0;
    }

    .search-input-group,
    .search-input-group .filter-input,
    .quick-range-group {
        min-width: 100%;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .section-summary {
        justify-content: flex-start;
        margin-left: 0;
    }

}

.product-split-layout {
    display: grid;
    grid-template-columns: minmax(420px, 620px) minmax(520px, 1fr);
    gap: 20px;
    align-items: stretch;
    margin-bottom: 4px;
}

#page-product {
    gap: 10px;
}

.product-prefix-option {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 36px;
    padding: 0 4px;
    color: #334155;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    user-select: none;
}

.product-option-group {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 36px;
}

.product-prefix-option input {
    width: 15px;
    height: 15px;
    accent-color: var(--primary);
}

.product-help-trigger {
    width: 20px;
    height: 20px;
    padding: 0;
    border: 1px solid #94a3b8;
    border-radius: 999px;
    background: #e5e7eb;
    color: #475569;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    transform: translateY(1px);
}

.product-help-trigger:hover {
    border-color: #64748b;
    background: #d1d5db;
    color: #334155;
}

.product-period-option {
    margin-left: 0;
}

.product-help-popover {
    position: fixed;
    z-index: 1400;
    min-width: 290px;
    max-width: 360px;
    padding: 10px 12px;
    background: #f3f4f6;
    border: 1px solid #cbd5e1;
    border-radius: 3px;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.18);
}

.product-help-popover::before {
    content: '';
    position: absolute;
    top: -7px;
    left: 18px;
    width: 12px;
    height: 12px;
    background: #f3f4f6;
    border-top: 1px solid #cbd5e1;
    border-left: 1px solid #cbd5e1;
    transform: rotate(45deg);
}

.product-help-popover-title {
    margin-bottom: 6px;
    color: #334155;
    font-size: 12px;
    font-weight: 800;
}

.product-help-body {
    color: #334155;
    font-size: 12px;
    line-height: 1.6;
    padding: 0;
}

.product-help-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.product-help-row {
    display: grid;
    grid-template-columns: 20px 1fr;
    gap: 8px;
    align-items: start;
}

.product-help-check {
    width: 16px;
    height: 16px;
    margin-top: 1px;
    border: 1px solid #94a3b8;
    border-radius: 3px;
    background: #ffffff;
    position: relative;
}

.product-help-check.checked {
    border-color: #2563eb;
    background: #2563eb;
}

.product-help-check.checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 4px;
    height: 8px;
    border-right: 2px solid #ffffff;
    border-bottom: 2px solid #ffffff;
    transform: rotate(40deg);
}

.product-help-text {
    min-width: 0;
}

.product-help-highlight {
    color: #1d4ed8;
    font-weight: 900;
}

.product-help-note {
    margin-top: 2px;
    padding-left: 28px;
    color: #475569;
    font-weight: 800;
}

.product-search-list-panel,
.product-placeholder-panel,
.product-detail-panel {
    min-height: 0;
}

.product-search-list-panel,
.product-placeholder-panel {
    height: 245px;
    max-height: 245px;
}

.product-list-wrap {
    max-height: 192px;
    overflow: auto;
}

.product-placeholder-panel {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
    overflow: hidden;
    padding: 0;
}

.product-info-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.panel-header.compact {
    padding: 12px 16px;
}

.product-info-header {
    display: grid;
    grid-template-columns: minmax(80px, 1fr) minmax(180px, auto) minmax(80px, 1fr);
    gap: 10px;
    align-items: center;
}

.product-info-header .panel-title {
    justify-self: start;
}

.product-info-header-spacer {
    min-width: 0;
}

.product-info-content {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 10px 12px;
}

.product-info-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 12px;
}

.product-info-table th,
.product-info-table td {
    border: 1px solid #e2e8f0;
    padding: 7px 8px;
    vertical-align: top;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.product-info-table th {
    width: 96px;
    background: #f8fafc;
    color: #475569;
    text-align: center;
    font-weight: 800;
}

.product-info-table td {
    color: #0f172a;
    font-weight: 600;
}

.product-info-table .pn-info-value {
    color: var(--primary);
    font-weight: 900;
}

.product-info-table .pn-info-value-prep,
.product-pn-prep {
    color: #4b5563;
    font-weight: 900;
}

.product-pn-normal {
    color: var(--primary);
    font-weight: 700;
}

.product-info-empty {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: #64748b;
    font-size: 13px;
}

.product-info-empty strong {
    color: #0f172a;
    font-size: 18px;
}

.product-info-main {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 12px;
}

.product-info-pn {
    color: var(--primary);
    font-size: 20px;
    font-weight: 900;
}

.product-info-sub {
    min-width: 0;
    color: #475569;
    font-size: 13px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-info-chip-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}

.product-info-chip {
    min-width: 0;
    padding: 9px 10px;
    border: 1px solid #c7d2fe;
    border-radius: 8px;
    background: #eef2ff;
}

.product-info-chip span,
.product-info-field span {
    display: block;
    color: #64748b;
    font-size: 11px;
    font-weight: 800;
}

.product-info-chip strong,
.product-info-field strong {
    display: block;
    min-width: 0;
    color: #0f172a;
    font-size: 13px;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.product-info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 12px;
}

.product-info-field {
    min-width: 0;
}

.product-info-remark {
    margin-top: 12px;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    color: #334155;
    font-size: 13px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.product-tab-area {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

.product-tab-bar {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 0 14px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    min-height: 46px;
}

.product-tab-display-name {
    justify-self: center;
    min-width: 180px;
    max-width: 360px;
    padding: 5px 14px;
    border: 1px solid #fde68a;
    border-radius: 999px;
    background: #fef3c7;
    color: #334155;
    font-size: 13px;
    font-weight: 800;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-detail-more-btn {
    min-width: 76px;
    height: 30px;
    margin-left: 10px;
    padding: 0 14px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #ffffff;
    color: #475569;
    font-size: 12px;
    font-weight: 800;
    text-align: center;
    cursor: pointer;
}

.product-detail-more-btn:hover {
    border-color: #94a3b8;
    background: #f1f5f9;
    color: #334155;
}

.product-detail-more-btn:disabled,
.product-detail-more-btn:disabled:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
    color: #94a3b8;
    cursor: default;
}

.product-tab-summary {
    margin-left: auto;
    min-width: 220px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    background: #ffffff;
    padding: 5px 10px;
    border-radius: 12px;
    border: 1px solid var(--border);
    text-align: right;
    white-space: nowrap;
}

.product-tab {
    height: 38px;
    padding: 0 16px;
    border: none;
    border-bottom: 3px solid transparent;
    background: transparent;
    color: #64748b;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.product-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: #eff6ff;
}

.product-tab:disabled {
    color: #94a3b8;
    cursor: default;
}

.product-tab-panel {
    display: none;
    min-height: 0;
    flex: 1 1 auto;
}

.product-tab-panel.active {
    display: flex;
    align-items: stretch;
}

.product-tab-panel .product-detail-panel {
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.product-detail-wrap {
    flex: 1 1 auto !important;
    width: 100%;
    max-height: none;
    min-height: 0;
    overflow: auto;
}

.product-search-container table {
    table-layout: fixed;
    min-width: 0;
    width: 100%;
}

.product-search-container table th:nth-child(1),
.product-search-container table td:nth-child(1) {
    width: 58px;
    text-align: center;
}

.product-search-container table th:nth-child(2),
.product-search-container table td:nth-child(2) {
    width: 82px;
}

.product-search-container table th:nth-child(3),
.product-search-container table td:nth-child(3) {
    width: 68px;
    text-align: right;
    padding-right: 8px !important;
    font-weight: 800;
    color: #0f172a;
}

.product-search-container table th:nth-child(4),
.product-search-container table td:nth-child(4) {
    width: 92px;
    text-align: center;
}

.product-search-container table th:nth-child(5),
.product-search-container table td:nth-child(5) {
    width: 170px;
    max-width: 170px;
    text-align: left;
}

.product-search-container td:nth-child(5) {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-search-container tbody tr,
.product-detail-panel tbody tr {
    cursor: pointer;
}

.product-detail-head {
    display: none;
}

.product-detail-name {
    font-size: 18px;
    font-weight: 800;
    color: #0f172a;
    padding-left: 12px;
}

.product-detail-title-row {
    display: flex;
    align-items: center;
    gap: 34px;
}

.product-detail-title-info {
    min-width: 260px;
    padding: 6px 14px;
    border: 1px solid #fde68a;
    border-radius: 999px;
    background: #fef3c7;
    color: #334155;
    font-size: 14px;
    font-weight: 800;
    text-align: center;
    white-space: nowrap;
}

.product-detail-meta {
    display: none;
}

.product-detail-panel .sale-type-cell {
    color: #0d9488 !important;
    font-weight: 700 !important;
}

#product-search-summary {
    font-size: 14px;
    font-weight: 800;
}

#product-detail-grid {
    width: max-content;
    min-width: 1320px !important;
    table-layout: auto !important;
    font-size: 13px;
}

#product-detail-grid th,
#product-detail-grid td {
    white-space: nowrap !important;
    word-break: keep-all;
    padding: 9px 14px !important;
}

#product-detail-grid th:nth-child(1),
#product-detail-grid td:nth-child(1) {
    min-width: 108px;
}

#product-detail-grid th:nth-child(2),
#product-detail-grid td:nth-child(2) {
    min-width: 170px;
}

#product-detail-grid th:nth-child(3),
#product-detail-grid td:nth-child(3) {
    min-width: 96px;
}

#product-detail-grid th:nth-child(4),
#product-detail-grid td:nth-child(4),
#product-detail-grid th:nth-child(5),
#product-detail-grid td:nth-child(5),
#product-detail-grid th:nth-child(6),
#product-detail-grid td:nth-child(6) {
    min-width: 96px;
}

#product-detail-grid th:nth-child(7),
#product-detail-grid td:nth-child(7) {
    min-width: 110px;
}

#product-detail-grid th:nth-child(8),
#product-detail-grid td:nth-child(8) {
    min-width: 160px;
}

#product-detail-grid th:nth-child(9),
#product-detail-grid td:nth-child(9) {
    min-width: 160px;
}

#product-detail-grid th:nth-child(10),
#product-detail-grid td:nth-child(10),
#product-detail-grid th:nth-child(11),
#product-detail-grid td:nth-child(11),
#product-detail-grid th:nth-child(12),
#product-detail-grid td:nth-child(12) {
    min-width: 116px;
}

#product-unpaid-grid {
    min-width: 1400px !important;
    table-layout: auto !important;
    font-size: 13px;
}

#product-unpaid-grid th {
    text-align: left;
    padding: 10px 12px !important;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 13px;
    letter-spacing: 0.5px;
    white-space: nowrap !important;
    word-break: normal;
}

#product-unpaid-grid td {
    padding: 8px 12px !important;
    white-space: nowrap !important;
    word-break: normal;
    font-size: 13px;
    text-align: left;
}

#product-unpaid-grid th:nth-child(2),
#product-unpaid-grid td:nth-child(2) {
    width: 130px;
    max-width: 130px;
}

#product-unpaid-grid th:nth-child(3),
#product-unpaid-grid td:nth-child(3) {
    width: 187px;
    max-width: 187px;
}

#product-unpaid-grid th:nth-child(10),
#product-unpaid-grid td:nth-child(10),
#product-unpaid-grid th:nth-child(11),
#product-unpaid-grid td:nth-child(11) {
    width: 141px;
    max-width: 141px;
}

#product-unpaid-grid th:nth-child(12),
#product-unpaid-grid td:nth-child(12) {
    width: 130px;
    max-width: 130px;
}

#product-unpaid-grid td:nth-child(2),
#product-unpaid-grid td:nth-child(10),
#product-unpaid-grid td:nth-child(11),
#product-unpaid-grid td:nth-child(12) {
    overflow: hidden;
    text-overflow: ellipsis;
}

#product-stock-grid {
    width: max-content !important;
    min-width: 0 !important;
    table-layout: auto !important;
    font-size: 13px;
}

#product-stock-grid th,
#product-stock-grid td {
    padding: 8px 12px !important;
    white-space: nowrap !important;
    word-break: normal;
    text-align: left;
}

#product-stock-grid th:nth-child(1),
#product-stock-grid td:nth-child(1) {
    width: 130px;
    max-width: 130px;
}

#product-stock-grid th:nth-child(2),
#product-stock-grid td:nth-child(2) {
    width: 100px;
    max-width: 100px;
}

#product-stock-grid th:nth-child(3),
#product-stock-grid td:nth-child(3) {
    width: 100px;
    max-width: 100px;
    text-align: right;
}

#product-stock-grid th:nth-child(4),
#product-stock-grid td:nth-child(4),
#product-stock-grid th:nth-child(5),
#product-stock-grid td:nth-child(5),
#product-stock-grid th:nth-child(6),
#product-stock-grid td:nth-child(6) {
    width: 130px;
    max-width: 130px;
    text-align: center;
}

#product-stock-grid th:nth-child(7),
#product-stock-grid td:nth-child(7) {
    width: 200px;
    max-width: 200px;
}

#product-stock-grid td:nth-child(1),
#product-stock-grid td:nth-child(2),
#product-stock-grid td:nth-child(4),
#product-stock-grid td:nth-child(5),
#product-stock-grid td:nth-child(6),
#product-stock-grid td:nth-child(7) {
    overflow: hidden;
    text-overflow: ellipsis;
}

.source-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    height: 22px;
    padding: 0 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 800;
    background: #e2e8f0;
    color: #0f172a;
}

.source-sem {
    background: #dbeafe;
    color: #1d4ed8;
}

.source-oem {
    background: #dcfce7;
    color: #15803d;
}

.source-wci {
    background: #fef3c7;
    color: #b45309;
}

.source-under,
.source-pre-p {
    background: #e5e7eb;
    color: #374151;
}

#page-admin-pn-upload {
    overflow: hidden;
}

.pn-upload-layout {
    display: grid;
    grid-template-columns: minmax(420px, 0.95fr) minmax(520px, 1.05fr);
    gap: 16px;
    flex: 1 1 auto;
    min-height: 0;
}

.pn-upload-input-panel,
.pn-upload-preview-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.pn-upload-textarea {
    flex: 1 1 auto;
    min-height: 360px;
    width: 100%;
    border: none;
    border-top: 1px solid var(--border);
    padding: 14px;
    resize: none;
    outline: none;
    color: #0f172a;
    font-family: Consolas, "Courier New", monospace;
    font-size: 12px;
    line-height: 1.55;
}

.pn-upload-preview-wrap {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

#pn-upload-preview-grid {
    min-width: 820px;
}

#pn-upload-preview-grid th:nth-child(1),
#pn-upload-preview-grid td:nth-child(1) {
    width: 110px;
}

#pn-upload-preview-grid th:nth-child(2),
#pn-upload-preview-grid td:nth-child(2) {
    width: 120px;
}

#pn-upload-preview-grid th:nth-child(3),
#pn-upload-preview-grid td:nth-child(3),
#pn-upload-preview-grid th:nth-child(4),
#pn-upload-preview-grid td:nth-child(4) {
    width: 150px;
}

#page-admin-users {
    overflow: hidden;
}

.user-admin-toolbar {
    flex: 0 0 auto;
}

.user-admin-search {
    min-width: 320px;
}

.user-admin-search .filter-input {
    min-width: 220px;
}

.user-admin-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(120px, 1fr));
    gap: 12px;
}

.user-summary-tile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 62px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-panel);
    box-shadow: var(--card-shadow);
}

.user-summary-tile span {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 700;
}

.user-summary-tile strong {
    color: #0f172a;
    font-size: 24px;
    font-weight: 800;
}

.user-admin-layout {
    display: grid;
    grid-template-columns: minmax(680px, 1fr) 340px;
    gap: 16px;
    min-height: 0;
    flex: 1 1 auto;
}

.user-admin-list-panel,
.user-admin-detail-panel {
    min-height: 0;
}

.user-admin-table-wrap {
    overflow: auto;
}

#user-admin-grid {
    table-layout: fixed;
    min-width: 960px;
    width: 100%;
}

#user-admin-grid th:nth-child(1),
#user-admin-grid td:nth-child(1) {
    width: 100px;
}

#user-admin-grid th:nth-child(2),
#user-admin-grid td:nth-child(2) {
    width: 96px;
    text-align: center;
}

#user-admin-grid th:nth-child(3),
#user-admin-grid td:nth-child(3),
#user-admin-grid th:nth-child(4),
#user-admin-grid td:nth-child(4) {
    width: 120px;
    text-align: center;
}

#user-admin-grid th:nth-child(5),
#user-admin-grid td:nth-child(5) {
    width: 92px;
    text-align: center;
}

#user-admin-grid th:nth-child(6),
#user-admin-grid td:nth-child(6),
#user-admin-grid th:nth-child(7),
#user-admin-grid td:nth-child(7) {
    width: 132px;
    text-align: center;
}

#user-admin-grid th:nth-child(8),
#user-admin-grid td:nth-child(8) {
    width: 72px;
    text-align: right;
}

#user-admin-grid tbody tr {
    cursor: pointer;
}

.authority-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 24px;
    padding: 0 8px;
    border-radius: 6px;
    background: #e0f2fe;
    color: #0369a1;
    font-size: 12px;
    font-weight: 800;
}

.authority-badge.empty {
    background: #f1f5f9;
    color: #94a3b8;
}

.user-admin-detail-panel {
    display: flex;
    flex-direction: column;
    padding: 18px;
}

.user-detail-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
}

.user-detail-form .form-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.user-detail-form label {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 800;
}

.user-detail-form input,
.user-detail-form textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #ffffff;
    color: var(--text-main);
    font-size: 13px;
    font-weight: 700;
    outline: none;
}

.user-detail-form input {
    min-height: 38px;
}

.user-detail-form textarea {
    min-height: 94px;
    resize: vertical;
    line-height: 1.5;
}

.user-detail-form input:read-only {
    background: #f8fafc;
    color: #475569;
}

.user-detail-form input:focus,
.user-detail-form textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.user-auth-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 30px;
}

.auth-preset {
    min-width: 48px;
    height: 28px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #f8fafc;
    color: #475569;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.auth-preset.active {
    border-color: var(--primary);
    background: #eff6ff;
    color: var(--primary);
}

.authority-badge-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: center;
}

.user-detail-actions {
    margin-top: auto;
}

.admin-chart-container {
    margin-bottom: 20px;
}

.admin-chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
    justify-content: center;
    text-align: center;
}

.admin-legend-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    color: #475569;
}

.admin-legend-swatch {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.admin-chart {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.admin-chart-row {
    display: grid;
    grid-template-columns: 132px 1fr;
    gap: 12px;
    align-items: center;
    min-height: 34px;
}

.admin-chart-name {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    text-align: center;
}

.admin-chart-track {
    display: flex;
    min-height: 30px;
    border-radius: 8px;
    overflow: hidden;
    background: #e2e8f0;
}

.admin-chart-segment {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    min-width: 28px;
}

.admin-person-cell {
    font-weight: 700;
    color: #0f172a;
    text-align: center !important;
}

.admin-total-cell {
    font-weight: 800;
    color: var(--primary);
}

#page-admin {
    overflow: auto;
    padding: 0 28px 10px;
}

#page-admin .grid-container,
#page-admin .admin-chart-container {
    flex: 0 0 auto;
    overflow: hidden;
    max-width: 1280px;
    margin: 0 auto 20px;
    width: 100%;
}

#page-admin .table-wrap {
    overflow: hidden;
}

#admin-login-grid {
    border-collapse: collapse;
    table-layout: fixed;
    min-width: 0;
    width: 100%;
    font-size: 13px;
}

#admin-login-grid th,
#admin-login-grid td {
    border-right: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    height: 38px;
    padding: 10px 12px;
    text-align: center;
    vertical-align: middle;
}

#admin-login-grid th:last-child,
#admin-login-grid td:last-child {
    border-right: none;
}

#admin-login-grid thead th {
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    font-size: 13px;
    font-weight: 800;
}

#admin-login-grid tbody tr:hover td {
    background: #f8fbff;
}

@media (max-width: 1400px) {
    .product-split-layout {
        grid-template-columns: 1fr;
    }

    .product-detail-wrap {
        max-height: none;
    }

    .product-search-list-panel,
    .product-placeholder-panel {
        height: 245px;
        max-height: 245px;
    }
}
