/* ===================================================
   테스트서버 POP - 터치 최적화 스타일시트
   =================================================== */

/* ===== Reset & Base ===== */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; user-select: none; }

:root {
    --primary: #1565C0;
    --primary-dark: #0D47A1;
    --primary-light: #E3F2FD;
    --success: #2E7D32;
    --success-light: #E8F5E9;
    --danger: #C62828;
    --danger-light: #FFEBEE;
    --warning: #F57F17;
    --warning-light: #FFF8E1;
    --info: #0277BD;
    --bg: #F5F5F5;
    --card: #FFFFFF;
    --text: #212121;
    --text-secondary: #757575;
    --text-light: #9E9E9E;
    --border: #E0E0E0;
    --border-dark: #BDBDBD;
    --header-h: 56px;
    --footer-h: 72px;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
}

html, body {
    width: 100%; height: 100%;
    margin: 0; padding: 0;
    font-family: 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif;
    font-size: 17px;
    color: var(--text);
    background: var(--bg);
    overflow: hidden;
    touch-action: manipulation;
}

/* ===== 페이지 레이아웃 ===== */
.page { display: none; flex-direction: column; width: 100%; height: 100%; }
.page.active { display: flex; }
.content { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 12px; }

/* ===== 헤더 ===== */
.header {
    height: var(--header-h); background: var(--primary); color: #fff;
    display: flex; align-items: center; padding: 0 12px; flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}
.header .back-btn {
    width: 44px; height: 44px; background: none; border: none; color: #fff;
    font-size: 22px; cursor: pointer; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}
.header .back-btn:active { background: rgba(255,255,255,0.2); }
.header .title { flex: 1; font-size: 19px; font-weight: 700; text-align: center; }
.header .header-right { font-size: 13px; opacity: 0.9; text-align: right; line-height: 1.5; }

/* ===== 메인 헤더 ===== */
.main-header {
    height: 60px; background: #1a3a8f; color: #fff;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; flex-shrink: 0;
}
.main-header .logo { font-size: 18px; font-weight: 700; letter-spacing: -0.3px; }
.main-header .logo-sub { font-size: 12px; opacity: 0.75; margin-top: 1px; }
.main-header .info { text-align: right; font-size: 12px; line-height: 1.6; opacity: 0.85; }
.main-header .info .user-name { font-weight: 700; }
.main-header .logout-btn {
    background: transparent; border: 1.5px solid rgba(255,255,255,0.6);
    color: #fff; padding: 6px 16px; border-radius: 6px;
    font-size: 13px; cursor: pointer; margin-left: 12px;
}
.main-header .logout-btn:hover { background: rgba(255,255,255,0.15); }
.main-header .logout-btn:active { background: rgba(255,255,255,0.3); }

/* ===== 푸터 ===== */
.footer {
    height: var(--footer-h); background: var(--card);
    border-top: 1px solid var(--border);
    display: flex; align-items: center; padding: 8px 6px; gap: 6px; flex-shrink: 0;
    position: relative; z-index: 10;
}
.footer .btn { flex: 1; min-width: 0; width: 100%; font-size: 18px; pointer-events: auto; cursor: pointer; }
.footer .btn * { pointer-events: none; }

/* ===== 버튼 ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 52px; min-width: 100px; padding: 0 20px;
    border: none; border-radius: var(--radius-sm);
    font-size: 17px; font-weight: 700; cursor: pointer;
    transition: transform 0.08s, opacity 0.08s;
}
.btn:active { transform: scale(0.96); opacity: 0.9; }
.btn:disabled { opacity: 0.4; pointer-events: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-outline { background: #fff; color: var(--primary); border: 2px solid var(--primary); }
.btn-outline-danger { background: #fff; color: var(--danger); border: 2px solid var(--danger); }
.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-full { flex: 1; }
.btn-lg { height: 60px; font-size: 19px; }
.btn-sm { height: 40px; min-width: 70px; font-size: 15px; padding: 0 14px; }

/* ===== 메뉴 그리드 ===== */
.menu-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
    padding: 0; margin: 0;
}
.menu-section-title {
    font-size: 13px; color: #666;
    font-weight: 500; padding: 0 0 8px; border-bottom: 1.5px solid #d0d5e0;
    margin: 0 0 12px; display: flex; align-items: center; gap: 8px;
}
.menu-grid + .menu-section-title { margin-top: 28px; }
.menu-tile {
    background: #fff; border-radius: 14px;
    padding: 28px 16px 22px; text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08); cursor: pointer;
    transition: all 0.18s; border: 1.5px solid #e8eaf0;
    min-height: 130px; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    user-select: none;
}
.menu-tile:hover { border-color: #1a3a8f; box-shadow: 0 4px 16px rgba(26,58,143,0.12); transform: translateY(-2px); }
.menu-tile:active { transform: scale(0.97); box-shadow: none; }
.menu-tile .icon {
    width: 44px; height: 44px; margin-bottom: 12px;
    display: flex; align-items: center; justify-content: center;
    color: #2d3748;
}
.menu-tile .icon svg { width: 36px; height: 36px; }
.menu-tile .label { font-size: 14px; font-weight: 500; line-height: 1.4; color: #2d3748; }
.menu-tile.wide { grid-column: span 2; }
.menu-tile.gmp {
    background: #f4f7ff; border-color: #c5d3f5;
}
.menu-tile.gmp:hover {
    border-color: #1a3a8f; background: #eaf0ff;
    box-shadow: 0 4px 16px rgba(26,58,143,0.15);
}
.menu-tile.gmp .icon { color: #1a3a8f; }
.menu-tile.gmp .label { color: #1a3a8f; }
.menu-section-title .gmp-badge {
    font-size: 10px; font-weight: 700;
    background: #e8f0fe; color: #1a3a8f;
    padding: 2px 7px; border-radius: 4px;
    letter-spacing: 0.3px;
}
@media (max-width: 900px) {
    .menu-grid { grid-template-columns: repeat(3, 1fr); }
    .menu-tile.wide { grid-column: span 1; }
}
@media (max-width: 640px) {
    .menu-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .menu-tile { min-height: 110px; padding: 20px 12px 16px; }
    .menu-tile .icon svg { width: 28px; height: 28px; }
    .menu-tile .label { font-size: 13px; }
    .menu-tile.wide { grid-column: span 1; }
}

/* ===== 로그인 ===== */
.login-container {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; height: 100%; padding: 24px; gap: 20px;
}
.login-box {
    background: var(--card); border-radius: 20px; padding: 32px;
    width: 100%; max-width: 460px; box-shadow: var(--shadow-lg);
}
.login-title { font-size: 28px; font-weight: 800; text-align: center; margin-bottom: 8px; color: var(--primary-dark); }
.login-subtitle { font-size: 14px; color: var(--text-secondary); text-align: center; margin-bottom: 24px; }

.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 14px; font-weight: 700; color: var(--text-secondary); margin-bottom: 6px; }
.form-select, .form-input {
    width: 100%; height: 52px; padding: 0 16px;
    border: 2px solid var(--border); border-radius: var(--radius-sm);
    font-size: 17px; background: #fff; color: var(--text);
    appearance: none; -webkit-appearance: none;
}
.form-select { background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%23757575'/%3E%3C/svg%3E") no-repeat right 16px center; padding-right: 40px; }
.form-select:focus, .form-input:focus { outline: none; border-color: var(--primary); }

/* ===== 날짜 바 ===== */
.date-bar {
    display: flex; align-items: center; justify-content: center; gap: 12px;
    padding: 10px; background: var(--card); border-radius: var(--radius);
    margin-bottom: 10px; box-shadow: var(--shadow);
}
.date-nav {
    width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--border);
    background: #fff; font-size: 20px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.date-nav:active { background: var(--primary-light); }
.date-display { font-size: 20px; font-weight: 700; min-width: 190px; text-align: center; }
.date-today {
    height: 38px; padding: 0 14px; background: var(--primary); color: #fff;
    border: none; border-radius: var(--radius-sm); font-size: 15px; font-weight: 700; cursor: pointer;
}

/* ===== 필터 ===== */
.filter-row { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; align-items: center; }

/* GMP 시작/종료 버튼 */
.gmp-btn-group {
    display: inline-flex; gap: 4px; margin-left: auto;
    border: 1.5px solid #d0d5e0; border-radius: 8px; overflow: hidden;
}
.gmp-btn {
    padding: 6px 14px; border: none; font-size: 13px; font-weight: 700;
    font-family: inherit; cursor: pointer; white-space: nowrap;
    transition: all 0.15s;
}
.gmp-btn.start { background: #1a3a8f; color: #fff; }
.gmp-btn.start:hover { background: #152fa0; }
.gmp-btn.start:disabled { background: #b0bec5; color: #fff; cursor: default; }
.gmp-btn.end { background: #c62828; color: #fff; }
.gmp-btn.end:hover { background: #a01a1a; }
.gmp-btn.end:disabled { background: #e0e0e0; color: #aaa; cursor: default; }
.gmp-btn.done { background: #e8f5e9; color: #1e7e34; cursor: default; }
.gmp-btn.print { background: #fff; color: #1a3a8f; border: 1.5px solid #1a3a8f; cursor: pointer; }
.gmp-btn.print:hover { background: #e8f0fe; }
.filter-chip {
    padding: 8px 16px; border-radius: 20px;
    border: 2px solid var(--border); background: #fff;
    font-size: 15px; font-weight: 600; cursor: pointer;
    white-space: nowrap;
}
.filter-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.filter-chip:active { transform: scale(0.95); }

.filter-select {
    height: 40px; padding: 0 12px; border: 2px solid var(--border);
    border-radius: var(--radius-sm); font-size: 15px; background: #fff;
    min-width: 120px;
}

/* ===== 카드형 리스트 ===== */
.card-list { display: flex; flex-direction: column; gap: 6px; }
.card-item {
    background: var(--card); border-radius: var(--radius); padding: 14px 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05); cursor: pointer;
    border: 2px solid transparent; transition: border-color 0.12s;
}
.card-item:active, .card-item.selected { border-color: var(--primary); background: var(--primary-light); }
.card-item .card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.card-item .card-title { font-size: 18px; font-weight: 700; }
.card-item .card-detail { display: flex; gap: 16px; font-size: 14px; color: var(--text-secondary); flex-wrap: wrap; }
.card-item .card-detail b { color: var(--text); }

/* ===== 상태 배지 ===== */
.badge {
    display: inline-block; padding: 4px 12px; border-radius: 12px;
    font-size: 13px; font-weight: 700; letter-spacing: 0.3px;
}
.badge-ready { background: #FFF3E0; color: #E65100; border: 1px solid #FFE0B2; }
.badge-ing { background: var(--warning-light); color: #E65100; border: 1px solid #FFE082; }
.badge-done { background: #E8F5E9; color: #2E7D32; border: 1px solid #C8E6C9; }

/* ===== 데이터 테이블 ===== */
.data-table {
    width: 100%; border-collapse: separate; border-spacing: 0;
    background: var(--card); border-radius: var(--radius); overflow: hidden;
    box-shadow: var(--shadow);
}
.data-table thead th {
    background: #455A64; color: #fff; padding: 10px 8px;
    font-size: 13px; font-weight: 600; text-align: center; white-space: nowrap;
    position: sticky; top: 0; z-index: 2;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #37474F;
}
.data-table tbody td {
    padding: 13px 8px; text-align: center; font-size: 16px;
    border-bottom: 1px solid #ECEFF1; vertical-align: middle;
    color: var(--text);
}
.data-table tbody tr:nth-child(even) td { background: #FAFAFA; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:active { background: var(--primary-light); }
.data-table tbody tr.selected { background: var(--primary-light); }
.data-table .cell-name {
    text-align: left; font-weight: 600; max-width: 140px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    color: #263238;
}
.data-table .cell-name-sm {
    text-align: left; font-weight: 600; max-width: 100px; font-size: 15px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    color: #263238;
}
.data-table .cell-spec-sm {
    font-size: 13px; max-width: 80px; color: var(--text-secondary);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.data-table .cell-qty { color: var(--primary); font-weight: 700; font-size: 17px; }
.data-table .cell-editable {
    background: #E3F2FD; cursor: pointer; border-radius: 6px;
    min-width: 80px; position: relative;
    border: 2px solid #90CAF9; box-shadow: inset 0 0 0 1px rgba(21,101,192,0.1);
}
.data-table .cell-editable:active { background: #BBDEFB; border-color: #1565C0; }
.data-table .row-summary { background: #ECEFF1 !important; font-weight: 700; }
.data-table .row-summary td { border-bottom: none !important; }

/* ===== 배치 테이블 ===== */
.batch-group { margin-bottom: 16px; }
.batch-group:last-child { margin-bottom: 0; }
.batch-header {
    display: flex; align-items: center; gap: 10px;
    background: linear-gradient(135deg, #1565C0, #0D47A1); color: #fff;
    padding: 11px 16px;
    border-radius: var(--radius) var(--radius) 0 0;
    font-weight: 700; font-size: 16px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}
.batch-header .batch-num {
    background: rgba(255,255,255,0.95); color: #0D47A1; border-radius: 50%;
    width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
    font-size: 16px; font-weight: 900; flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.batch-group .data-table {
    border-radius: 0 0 var(--radius) var(--radius);
    border-top: none;
}
.batch-group .data-table thead th {
    background: #ECEFF1; color: #455A64;
    font-size: 12px; font-weight: 700;
    border-bottom: 2px solid #CFD8DC;
    padding: 8px 6px;
}

/* ===== 정보 바 ===== */
.info-bar {
    background: var(--primary); color: #fff; padding: 12px 16px;
    border-radius: var(--radius); margin-bottom: 10px;
    display: flex; justify-content: space-between; align-items: center;
}
.info-bar .info-title { font-size: 18px; font-weight: 700; }
.info-bar .info-sub { font-size: 13px; opacity: 0.85; }
.info-bar .info-value { font-size: 15px; text-align: right; }

/* ===== 2분할 레이아웃 ===== */
.split-layout { display: flex; gap: 10px; height: 100%; }
.split-left { width: 33%; display: flex; flex-direction: column; overflow: hidden; }
.split-right { width: 67%; display: flex; flex-direction: column; overflow: hidden; }
.split-panel { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; position: relative; z-index: 1; }

/* ===== 숫자패드 ===== */
.numpad-overlay {
    display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); z-index: 999;
    justify-content: center; align-items: center;
}
.numpad-overlay.show { display: flex; }
.numpad-container {
    background: var(--card); border-radius: 20px;
    padding: 20px; width: 100%; max-width: 420px;
    box-shadow: var(--shadow-lg);
}
.numpad-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.numpad-field { font-size: 15px; color: var(--text-secondary); }
.numpad-unit { font-size: 13px; color: var(--text-light); }
.numpad-display {
    background: #F5F5F5; border: 2px solid var(--primary); border-radius: var(--radius);
    padding: 14px 16px; font-size: 32px; font-weight: 700;
    text-align: right; margin-bottom: 14px; min-height: 64px;
    display: flex; align-items: center; justify-content: flex-end;
}
.numpad-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.numpad-key {
    height: 58px; border: 1px solid var(--border); border-radius: var(--radius);
    background: #fff; font-size: 22px; font-weight: 700; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.numpad-key:active { background: var(--primary-light); }
.numpad-key.key-clear { background: var(--danger-light); color: var(--danger); }
.numpad-key.key-back { background: var(--warning-light); color: var(--warning); }
.numpad-actions { display: flex; gap: 8px; margin-top: 10px; }

/* ===== 다이얼로그 ===== */
.dialog-overlay {
    display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); z-index: 200;
    justify-content: center; align-items: center;
}
.dialog-overlay.show { display: flex; }
.dialog-box {
    background: var(--card); border-radius: 20px; padding: 28px;
    width: 90%; max-width: 380px; text-align: center;
}
.dialog-icon { font-size: 44px; margin-bottom: 14px; }
.dialog-msg { font-size: 19px; font-weight: 700; margin-bottom: 6px; }
.dialog-sub { font-size: 15px; color: var(--text-secondary); margin-bottom: 20px; }
.dialog-actions { display: flex; gap: 10px; }

/* ===== 완료 화면 ===== */
.complete-wrap {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; height: 100%; text-align: center; padding: 40px;
}
.complete-icon {
    width: 100px; height: 100px; background: var(--success-light); border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 50px; margin-bottom: 20px;
}
.complete-msg { font-size: 26px; font-weight: 800; margin-bottom: 6px; }
.complete-detail { font-size: 17px; color: var(--text-secondary); margin-bottom: 32px; line-height: 1.6; }

/* ===== 토스트 ===== */
.toast {
    position: fixed; bottom: 90px; left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: #323232; color: #fff; padding: 14px 28px;
    border-radius: var(--radius); font-size: 16px; font-weight: 600;
    z-index: 300; opacity: 0; transition: all 0.25s ease;
    max-width: 90%;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.toast-success { background: var(--success); }
.toast.toast-error { background: var(--danger); }

/* ===== 로딩 ===== */
.loading-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.7); z-index: 250;
    display: none; justify-content: center; align-items: center;
}
.loading-overlay.show { display: flex; }
.spinner {
    width: 48px; height: 48px; border: 4px solid var(--border);
    border-top-color: var(--primary); border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 체크박스 (터치용) ===== */
.touch-check {
    width: 40px; height: 40px; border: 2px solid var(--border);
    border-radius: var(--radius-sm); background: #fff; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; color: transparent; margin: 0 auto;
}
.touch-check.checked { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ===== 빈 상태 ===== */
.empty-state {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; padding: 40px; color: var(--text-light);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
.empty-state .empty-msg { font-size: 16px; }

/* ===== 통계 바 ===== */
.stat-bar {
    display: flex; gap: 8px; margin-bottom: 10px;
}
.stat-item {
    flex: 1; background: var(--card); border-radius: var(--radius-sm);
    padding: 10px; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.stat-item .stat-label { font-size: 12px; color: var(--text-secondary); }
.stat-item .stat-value { font-size: 22px; font-weight: 800; color: var(--primary); }
.stat-item.stat-success .stat-value { color: var(--success); }
.stat-item.stat-warning .stat-value { color: var(--warning); }

/* ===== 계량 다이얼로그 ===== */
.weighing-overlay {
    display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); z-index: 150;
    justify-content: center; align-items: center;
}
.weighing-overlay.show { display: flex; }
.weighing-dialog {
    background: var(--card); border-radius: 20px;
    width: 95%; max-width: 480px;
    box-shadow: var(--shadow-lg); overflow: hidden;
}
.weighing-dialog-header {
    background: var(--primary); color: #fff;
    padding: 16px 20px; font-size: 19px; font-weight: 700;
    text-align: center;
}
.weighing-dialog-body { padding: 16px 20px; }
.weighing-info-grid { margin-bottom: 14px; }
.wd-info-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 0; border-bottom: 1px solid #F0F0F0;
}
.wd-info-row:last-child { border-bottom: none; }
.wd-lot-row {
    cursor: pointer; min-height: 48px; padding: 12px 12px;
    background: linear-gradient(90deg, var(--primary-light) 0%, #fff 70%, #E0E0E0 100%);
    border-radius: var(--radius-sm); margin: 4px -8px; border-bottom: none;
    border: 1px solid var(--border);
}
.wd-lot-row:active { background: linear-gradient(90deg, #BBDEFB 0%, #E3F2FD 100%); }
.wd-label { font-size: 14px; color: var(--text-secondary); font-weight: 600; }
.wd-val { font-size: 16px; font-weight: 700; color: var(--text); }
.wd-val-primary { color: var(--primary); }
.wd-val-success { color: var(--success); }
.wd-val-danger { color: var(--danger); }

.weighing-input-area { margin-bottom: 12px; }
.weighing-input-label { font-size: 14px; color: var(--text-secondary); font-weight: 600; margin-bottom: 6px; }
.weighing-input-display {
    background: #F5F5F5; border: 3px solid var(--primary); border-radius: var(--radius);
    padding: 16px; font-size: 36px; font-weight: 800;
    text-align: right; cursor: pointer; min-height: 70px;
    display: flex; align-items: center; justify-content: flex-end;
    color: var(--primary);
}
.weighing-input-display:active { background: var(--primary-light); }
.weighing-manual-input {
    width: 100%; padding: 14px 16px; font-size: 24px; font-weight: 700;
    border: 3px solid var(--success); border-radius: var(--radius);
    text-align: right; color: var(--success); background: #F5F5F5;
    outline: none; margin-top: 8px;
}
.weighing-manual-input:focus { background: #fff; border-color: var(--success); }

.weighing-validation { min-height: 44px; margin-bottom: 4px; }
.wd-msg {
    padding: 10px 14px; border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 700; text-align: center;
}
.wd-msg-ok { background: var(--success-light); color: var(--success); border: 1px solid #A5D6A7; }
.wd-msg-error { background: var(--danger-light); color: var(--danger); border: 1px solid #EF9A9A; }
.wd-msg-warn { background: var(--warning-light); color: var(--warning); border: 1px solid #FFE082; }

.weighing-dialog-actions {
    display: flex; gap: 10px; padding: 12px 20px 20px;
}

/* 계량 테이블 행 스타일 */
.weighing-row-done { cursor: pointer; }
.weighing-row-done td { color: var(--text-secondary) !important; }
.weighing-row-wait { cursor: pointer; }
.weighing-row-wait:active { background: var(--primary-light) !important; }

/* ===== 투입완료 행 (공정자재투입) ===== */
.row-input-done { opacity: 0.5; }
.row-input-done td { color: var(--text-secondary) !important; }
.input-done-check {
    background: var(--success) !important; border-color: var(--success) !important;
    color: #fff !important; pointer-events: none;
}

/* ===== 시간/인원 입력 그리드 (사용자재투입, 제품생산등록) ===== */
.work-info-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 8px; margin-top: 8px;
}
.work-info-item {
    background: var(--card); border-radius: var(--radius-sm);
    padding: 10px; box-shadow: var(--shadow);
}
.work-info-label {
    font-size: 12px; color: var(--text-secondary); margin-bottom: 4px;
}
.work-info-value {
    font-size: 18px; font-weight: 700; cursor: pointer;
    text-align: center; min-height: 28px;
    display: flex; align-items: center; justify-content: center;
}
.work-info-value.readonly { cursor: default; color: var(--text-secondary); }
.work-info-value.cell-touch {
    background: #E3F2FD; border: 2px solid #90CAF9; border-radius: var(--radius-sm);
    padding: 4px 8px; cursor: pointer;
}
.work-info-value.cell-touch:active { background: #BBDEFB; border-color: #1565C0; }

/* 한 줄 compact 레이아웃 */
.work-info-row {
    display: flex; gap: 6px; margin-top: 8px; margin-bottom: 4px; align-items: center;
}
.work-info-item-compact {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    min-width: 0;
}
.work-info-label-sm {
    font-size: 11px; color: var(--text-secondary); font-weight: 600; white-space: nowrap;
}
.work-info-val-sm {
    font-size: 16px; font-weight: 700; text-align: center; min-height: 36px; width: 100%;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.work-info-val-sm.readonly { cursor: default; color: var(--text-secondary); }
.work-info-val-sm.cell-touch {
    background: #E3F2FD; border: 2px solid #90CAF9; border-radius: var(--radius-sm);
    padding: 2px 4px;
}
.work-info-val-sm.cell-touch:active { background: #BBDEFB; border-color: #1565C0; }
.time-input-sm {
    width: 100%; height: 36px; padding: 0 4px;
    border: 2px solid #90CAF9; border-radius: var(--radius-sm);
    font-size: 15px; font-weight: 700; text-align: center;
    color: var(--text); background: #E3F2FD;
}
.time-input-sm:focus { border-color: var(--primary); outline: none; background: #fff; }
.time-input-sm:disabled { background: #F5F5F5; color: var(--text-secondary); opacity: 0.7; border-color: var(--border); }
.time-input {
    width: 100%; height: 44px; padding: 0 8px;
    border: 2px solid #90CAF9; border-radius: var(--radius-sm);
    font-size: 18px; font-weight: 700; text-align: center;
    color: var(--text); background: #E3F2FD;
}
.time-input:focus { border-color: var(--primary); outline: none; background: #fff; }
.time-input:disabled { background: #F5F5F5; color: var(--text-secondary); opacity: 0.7; border-color: var(--border); }

/* ===== 로트번호 선택 팝업 ===== */
.lot-popup-overlay {
    display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); z-index: 160;
    justify-content: center; align-items: center;
}
.lot-popup-overlay.show { display: flex; }
.lot-popup {
    background: var(--card); border-radius: 20px;
    width: 95%; max-width: 500px; max-height: 80vh;
    box-shadow: var(--shadow-lg); overflow: hidden;
    display: flex; flex-direction: column;
}
.lot-popup-header {
    background: var(--primary); color: #fff;
    padding: 16px 20px; font-size: 19px; font-weight: 700;
    display: flex; justify-content: space-between; align-items: center;
    flex-shrink: 0;
}
.lot-popup-close {
    background: none; border: none; color: #fff; font-size: 22px;
    width: 40px; height: 40px; cursor: pointer; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}
.lot-popup-close:active { background: rgba(255,255,255,0.2); }
.lot-popup-body {
    flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
    padding: 12px; min-height: 120px;
}
.lot-popup-actions {
    display: flex; gap: 10px; padding: 12px 16px;
    border-top: 1px solid var(--border); flex-shrink: 0;
}
.lot-item {
    background: #FAFAFA; border: 2px solid var(--border);
    border-radius: var(--radius); padding: 14px 16px;
    margin-bottom: 8px; cursor: pointer;
    transition: border-color 0.12s;
}
.lot-item:last-child { margin-bottom: 0; }
.lot-item:active { border-color: var(--primary); background: var(--primary-light); }
.lot-item.lot-selected { border-color: var(--primary); background: var(--primary-light); }
.lot-main {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 4px;
}
.lot-code { font-size: 17px; font-weight: 700; color: var(--text); }
.lot-qty { font-size: 17px; font-weight: 700; color: var(--primary); }
.lot-sub {
    display: flex; gap: 12px; flex-wrap: wrap;
    font-size: 13px; color: var(--text-secondary);
}

/* ===== BMR (제조기록서) ===== */
.bmr-section-title {
    font-size: 11px; font-weight: 700; color: #888; letter-spacing: 0.8px;
    margin: 16px 0 8px; text-transform: uppercase;
}
.bmr-section-title:first-child { margin-top: 0; }
.bmr-card {
    background: #fff; border-radius: 10px; border: 1.5px solid #e8eaf0;
    padding: 12px 14px; margin-bottom: 12px; box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.bmr-info-row {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 10px; background: #f7f9fc; border-radius: 6px; margin-bottom: 5px;
}
.bmr-info-row:last-child { margin-bottom: 0; }
.bmr-label { font-size: 11px; color: #888; min-width: 70px; flex-shrink: 0; }
.bmr-value { font-size: 13px; font-weight: 500; color: #1a2035; flex: 1; }
.bmr-step-wrap { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.bmr-step {
    flex: 1; min-width: 64px; text-align: center; padding: 10px 6px;
    border-radius: 10px; border: 2px solid;
}
.bmr-step.done { background: #d4edda; border-color: #28a745; }
.bmr-step.cur { background: #cce5ff; border-color: #1a3a8f; }
.bmr-step.wait { background: #f8f9fa; border-color: #dee2e6; }
.bmr-step-st { font-size: 10px; font-weight: 700; }
.bmr-step.done .bmr-step-st { color: #155724; }
.bmr-step.cur .bmr-step-st { color: #1a3a8f; }
.bmr-step.wait .bmr-step-st { color: #aaa; }
.bmr-step-nm { font-size: 13px; font-weight: 700; margin-top: 3px; color: #333; }
.bmr-step.done .bmr-step-nm { color: #155724; }
.bmr-step.cur .bmr-step-nm { color: #1a3a8f; }
.bmr-step.wait .bmr-step-nm { color: #aaa; }
.bmr-step-arr { color: #bbb; font-size: 14px; flex-shrink: 0; font-weight: 700; }
.bmr-tbl-wrap {
    overflow-x: auto; border-radius: 10px; border: 1.5px solid #e8eaf0;
    margin-bottom: 12px;
}
.bmr-tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.bmr-tbl th {
    padding: 8px 10px; background: #f4f7fb; color: #666; font-weight: 600;
    text-align: left; border-bottom: 1.5px solid #e8eaf0; white-space: nowrap;
}
.bmr-tbl td { padding: 9px 10px; border-bottom: 1px solid #f0f0f0; }
.bmr-tbl tr:last-child td { border-bottom: none; }
.bmr-input {
    width: 100%; padding: 8px 10px; border: 1.5px solid #e0e4ef; border-radius: 6px;
    font-size: 13px; font-family: inherit; color: #1a2035; background: #fff;
}
.bmr-input:focus { outline: none; border-color: #1a3a8f; }
.bmr-input:disabled { background: #f5f5f5; color: #999; }
.bmr-textarea {
    width: 100%; min-height: 60px; padding: 10px 12px; border: 1.5px solid #e0e4ef;
    border-radius: 6px; font-size: 13px; font-family: inherit; color: #1a2035;
    resize: vertical;
}
.bmr-textarea:disabled { background: #f5f5f5; color: #999; }
.bmr-approval {
    display: flex; border: 1.5px solid #e0e4ef; border-radius: 10px;
    overflow: hidden; margin-bottom: 14px;
}
.bmr-ap-cell {
    flex: 1; padding: 10px 12px; border-right: 1.5px solid #e0e4ef; background: #fafbfd;
}
.bmr-ap-cell:last-child { border-right: none; }
.bmr-ap-role {
    font-size: 9px; font-weight: 700; color: #888; letter-spacing: 0.5px;
    margin-bottom: 4px; text-transform: uppercase;
}
.bmr-ap-name { font-size: 13px; font-weight: 600; color: #ccc; min-height: 20px; }
.bmr-ap-name.signed { color: #1e7e34; }
.bmr-ap-time { font-size: 9px; color: #aaa; margin-top: 2px; font-family: monospace; }
.bmr-ap-btn {
    display: inline-block; margin-top: 6px; padding: 5px 12px; border-radius: 6px;
    font-size: 11px; font-weight: 700; border: none; cursor: pointer; font-family: inherit;
}
.bmr-ap-btn.review { background: #e8f0fe; color: #1a3a8f; }
.bmr-ap-btn.review:hover { background: #d0e0fc; }
.bmr-ap-btn.approve { background: #e6f4ea; color: #1e7e34; }
.bmr-ap-btn.approve:hover { background: #c8e6c9; }
@media (max-width: 640px) {
    .bmr-approval { flex-direction: column; }
    .bmr-ap-cell { border-right: none; border-bottom: 1.5px solid #e0e4ef; }
    .bmr-ap-cell:last-child { border-bottom: none; }
}

/* ===== Pre-check 팝업 ===== */
.precheck-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    z-index: 200; display: flex; align-items: center; justify-content: center; padding: 16px;
}
.precheck-popup {
    background: #fff; border-radius: 16px; width: 100%; max-width: 520px;
    max-height: 85vh; display: flex; flex-direction: column;
    box-shadow: 0 8px 40px rgba(0,0,0,0.2); overflow: hidden;
}
.precheck-header {
    background: #1a3a8f; color: #fff; padding: 16px 20px;
    font-size: 16px; font-weight: 700; flex-shrink: 0;
}
.precheck-body {
    flex: 1; overflow-y: auto; padding: 16px; -webkit-overflow-scrolling: touch;
}
.precheck-actions {
    display: flex; gap: 8px; padding: 12px 16px;
    border-top: 1.5px solid #e8eaf0; flex-shrink: 0;
}
.precheck-item {
    display: flex; align-items: center; gap: 10px;
    padding: 12px; border-radius: 8px; border: 1.5px solid #e8eaf0;
    margin-bottom: 8px; cursor: pointer; transition: all 0.15s; user-select: none;
}
.precheck-item.checked { background: #e6f4ea; border-color: #a8d5b5; }
.precheck-item:active { transform: scale(0.99); }
.precheck-num { font-size: 11px; color: #aaa; min-width: 22px; text-align: center; }
.precheck-text { font-size: 13px; flex: 1; line-height: 1.5; }
.precheck-input {
    width: 60px; padding: 4px 8px; border: 1.5px solid #d0d5e0; border-radius: 6px;
    font-size: 13px; text-align: center; flex-shrink: 0;
}
.precheck-chk {
    width: 28px; height: 28px; border-radius: 7px; border: 2px solid #d0d5e0;
    background: #fff; display: flex; align-items: center; justify-content: center;
    font-size: 16px; color: transparent; flex-shrink: 0; transition: all 0.15s;
}
.precheck-item.checked .precheck-chk {
    background: #1e7e34; border-color: #1e7e34; color: #fff;
}

/* ===== AM KPI 카드 ===== */
.am-kpi {
    background: #fff; border-radius: 10px; border: 2px solid #e0e0e0;
    padding: 10px; text-align: center; transition: all 0.15s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.am-kpi:hover { transform: translateY(-1px); box-shadow: 0 3px 10px rgba(0,0,0,0.1); }
.am-kpi.active { border-width: 2px; box-shadow: 0 3px 12px rgba(0,0,0,0.12); }
.cycle-tag { font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 4px; }
.cy-d { background: #e8f0fe; color: #1a3a8f; }
.cy-w { background: #e6f4ea; color: #1e7e34; }
.cy-m { background: #fff8e1; color: #f57c00; }
.cy-q { background: #f3e8ff; color: #6b21a8; }
.cy-y { background: #fde8e8; color: #c62828; }
