* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Malgun Gothic", "맑은 고딕", sans-serif;
    background: #f2f4f7;
    color: #222;
}
.login-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}
.login-box {
    background: #fff;
    padding: 40px 36px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    width: 320px;
    text-align: center;
}
.login-box h2 { margin: 0 0 4px; font-size: 20px; }
.login-box .sub { color: #888; margin-bottom: 24px; font-size: 13px; }
.field { text-align: left; margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: #555; margin-bottom: 4px; }
.field input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}
button {
    width: 100%;
    padding: 11px;
    background: #2d5be3;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    cursor: pointer;
    margin-top: 8px;
}
button:hover { background: #2249c2; }
.error-msg {
    background: #fdecea;
    color: #c0392b;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 16px;
}
.hint { color: #999; font-size: 12px; margin-top: 16px; }
.welcome-wrap {
    max-width: 480px;
    margin: 80px auto;
    background: #fff;
    padding: 32px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    text-align: center;
}
.welcome-wrap button {
    width: auto;
    padding: 8px 20px;
    background: #888;
    margin-top: 20px;
}

/* ===== 메인 메뉴 화면 ===== */
.main-wrap {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px 16px;
}
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    background: #fff;
    padding: 18px 24px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}
.main-title h2 { margin: 0; font-size: 20px; }
.user-info { color: #666; font-size: 13px; }
.header-right { display: flex; align-items: center; gap: 16px; }
.limit-amt {
    font-size: 14px;
    font-weight: bold;
    color: #2d5be3;
    background: #eef2fd;
    padding: 8px 14px;
    border-radius: 6px;
}
.logout-form { margin: 0; }
.btn-logout {
    width: auto;
    padding: 8px 16px;
    background: #888;
    margin: 0;
    font-size: 13px;
}
.menu-section { margin-top: 24px; }
.menu-cat {
    font-size: 15px;
    color: #444;
    border-left: 4px solid #2d5be3;
    padding-left: 10px;
    margin: 0 0 14px;
}
.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
}
.menu-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    background: #fff;
    padding: 26px 12px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    text-decoration: none;
    color: #333;
    font-size: 14px;
    transition: transform .1s, box-shadow .1s;
    border: 2px solid transparent;
}
.menu-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.10);
    border-color: #c8d4f5;
}
.menu-primary {
    border-color: #2d5be3;
    background: #f7f9ff;
}
.menu-icon { font-size: 30px; }
.menu-name { font-weight: 600; }

/* ===== 발주진행 조회 화면 ===== */
.list-wrap { max-width: 1400px; margin: 0 auto; padding: 24px 16px; }
.btn-back { font-size: 13px; color: #555; text-decoration: none; }
.filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    padding: 14px 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    margin-top: 16px;
    flex-wrap: wrap;
}
.filter-bar label { font-size: 13px; color: #555; }
.filter-bar input[type=date] {
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}
.btn-search {
    width: auto;
    padding: 9px 22px;
    margin: 0;
    font-size: 14px;
}
.empty-msg {
    background: #fff;
    color: #888;
    text-align: center;
    padding: 40px;
    border-radius: 10px;
    margin-top: 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}
.table-scroll { overflow-x: auto; margin-top: 8px; border-radius: 10px; box-shadow: 0 2px 10px rgba(0,0,0,0.06); }
.data-table {
    border-collapse: collapse;
    width: 100%;
    background: #fff;
    font-size: 13px;
    white-space: nowrap;
}
.data-table th {
    background: #f0f3f9;
    padding: 10px 10px;
    border-bottom: 2px solid #dde3ef;
    text-align: center;
    position: sticky;
    top: 0;
}
.data-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #eee;
    text-align: center;
}
.data-table td.num { text-align: right; }
.data-table td.left { text-align: left; }
.data-table tbody tr:hover { background: #f7f9ff; }
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
}
.badge-wait { background: #f0f0f0; color: #777; }
.badge-run  { background: #fff3d9; color: #b07d00; }
.badge-done { background: #e8f7ee; color: #1e7e44; }

/* 비밀번호 미설정 안내 배너 */
.pass-banner {
    background: #fff8e1;
    color: #9a6b00;
    border: 1px solid #f3dfa0;
    padding: 12px 18px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 16px;
}

/* 관리자 거래처 전환 링크 */
.admin-switch {
    font-size: 13px;
    color: #b03030;
    background: #fdeeee;
    padding: 8px 14px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
}

/* ===== 발주등록 폼 ===== */
.ok-msg {
    background: #e8f7ee;
    color: #1e7e44;
    padding: 12px 18px;
    border-radius: 8px;
    font-size: 14px;
    margin-top: 16px;
}
.entry-form fieldset {
    background: #fff;
    border: none;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    margin-top: 16px;
    padding: 18px 22px;
}
.entry-form legend {
    font-size: 14px;
    font-weight: 700;
    color: #2d5be3;
    padding: 0 6px;
}
.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 10px;
}
.form-item { display: flex; flex-direction: column; min-width: 110px; flex: 1; }
.form-item.wide { flex: 1 1 100%; }
.form-item.sc { min-width: 64px; flex: 0 1 72px; }
.form-item label { font-size: 12px; color: #666; margin-bottom: 4px; }
.form-item input, .form-item select {
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}
.entry-actions { margin-top: 18px; }
.entry-actions button { width: auto; padding: 12px 40px; font-size: 15px; }

/* 자동계산 필드 (읽기전용) */
.calc-field {
    background: #f4f6fa !important;
    color: #2d5be3;
    font-weight: 600;
}

/* 실시간 검증 에러 문구 */
.field-err {
    color: #d0342c;
    font-size: 12px;
    margin-top: 3px;
    min-height: 1px;
    line-height: 1.3;
}

/* 스코아구분 라디오 */
.radio-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
}
.radio-item {
    font-size: 13px;
    color: #444;
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    padding: 4px 0;
}

/* 상자 발주등록 - 선택 품목 정보 패널 */
.box-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
    margin-top: 12px;
    background: #f7f9ff;
    border: 1px solid #dbe4fb;
    border-radius: 8px;
    padding: 14px 18px;
}
.box-info-item { display: flex; flex-direction: column; gap: 3px; }
.bi-label { font-size: 11px; color: #7a86a8; }
.bi-value { font-size: 15px; font-weight: 700; color: #21396e; }

/* 품목 선택 시 정보 패널 강조 */
@keyframes boxinfo-flash {
    0%   { background: #dbe7ff; }
    100% { background: transparent; }
}
#boxInfo.flash { animation: boxinfo-flash 0.6s ease-out; border-radius: 8px; }


/* ===== 조회 메뉴 (매입/재고/결재) 공통 ===== */
.sub-title { margin: 24px 0 8px; font-size: 15px; color: #334; }
.row-total td { background: #fff7dd; font-weight: 600; }
.row-selected td { background: #e7f0ff; }
.th-sort { color: inherit; text-decoration: none; }
.th-sort:hover { text-decoration: underline; }
.radio-inline { margin-right: 6px; white-space: nowrap; font-size: 13px; }
.radio-inline input { vertical-align: -2px; }

.tab-bar { display: flex; gap: 6px; margin: 12px 0 4px; }
.tab-item {
    padding: 7px 22px; border: 1px solid #c6cede; border-bottom: none;
    border-radius: 8px 8px 0 0; background: #eef1f6; color: #556;
    text-decoration: none; font-size: 14px;
}
.tab-item.tab-active { background: #2b6cb0; color: #fff; border-color: #2b6cb0; font-weight: 600; }

.pay-info {
    display: flex; flex-wrap: wrap; gap: 8px 18px;
    background: #f6f8fb; border: 1px solid #dde3ec; border-radius: 8px;
    padding: 10px 14px; margin: 10px 0 4px; font-size: 13px;
}
.pay-info-item { display: flex; gap: 8px; align-items: baseline; }
.pay-info-item .pay-label { color: #778; font-size: 12px; }
.pay-info-item .num { font-weight: 600; }


/* =====================================================================
   UI 개선 (2026-09) : 그리드 가독성 / 필터바 / 공통 컴포넌트
   ===================================================================== */
:root {
    --brand: #2d5be3;
    --brand-dark: #2249c2;
    --ink: #2a3145;
    --ink-soft: #5b6478;
    --line: #e4e8f1;
    --bg-soft: #f6f8fc;
}

body {
    background: #eef1f7;
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

/* --- 페이지 헤더 --- */
.main-header {
    border-top: 3px solid var(--brand);
}
.main-title h2 { letter-spacing: -0.5px; }
.btn-back {
    display: inline-block;
    padding: 7px 14px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--ink-soft);
    transition: background .12s, color .12s;
}
.btn-back:hover { background: var(--bg-soft); color: var(--brand); }

/* --- 필터바 --- */
.filter-bar { gap: 8px 12px; }
.filter-bar label {
    font-weight: 600;
    color: var(--ink-soft);
    margin-left: 6px;
}
.filter-bar label:first-child { margin-left: 0; }
.filter-bar select,
.filter-bar input[type=text],
.filter-bar input[type=date] {
    padding: 8px 10px;
    border: 1px solid #d4dae6;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    color: var(--ink);
}
.filter-bar select:focus,
.filter-bar input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(45, 91, 227, 0.12);
}
.radio-inline {
    color: var(--ink-soft);
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 6px;
}
.radio-inline:hover { background: var(--bg-soft); }

/* --- 그리드 상단 도구줄 --- */
.grid-tools {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 16px;
}
.count-badge {
    background: var(--brand);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 20px;
}
.tools-note { font-size: 12px; color: #8a93a8; }
.btn-excel {
    width: auto;
    margin: 0 0 0 auto;
    padding: 7px 16px;
    font-size: 13px;
    font-weight: 600;
    background: #1e7e44;
    border-radius: 6px;
}
.btn-excel:hover { background: #16693a; }
.grid-tools .sub-title { font-weight: 700; color: var(--ink); }

/* --- 데이터 그리드 가독성 --- */
.table-scroll {
    margin-top: 10px;
    border: 1px solid var(--line);
    box-shadow: 0 2px 8px rgba(30, 40, 70, 0.05);
    max-height: 72vh;
    overflow: auto;
    background: #fff;
}
.data-table { font-size: 13px; }
.data-table th {
    background: #f4f6fb;
    color: #46506a;
    font-size: 12px;
    font-weight: 700;
    padding: 11px 10px;
    border-bottom: 1px solid #d9dfec;
    box-shadow: inset 0 -2px 0 #dfe5f0;
    z-index: 1;
}
.data-table td {
    padding: 9px 10px;
    border-bottom: 1px solid #f0f2f8;
    color: #333a4e;
    line-height: 1.4;
}
.data-table td.num,
.data-table th.num {
    font-variant-numeric: tabular-nums;
}
.data-table tbody tr:nth-child(even) { background: #fafbfe; }
.data-table tbody tr:hover { background: #eef4ff; }
.data-table tbody tr:last-child td { border-bottom: none; }
.row-total td { background: #fff6d9 !important; border-top: 2px solid #f0dfa0; }
.row-selected td { background: #dcebff !important; }

/* --- 탭 --- */
.tab-bar { margin-top: 16px; }
.tab-item {
    background: #fff;
    border: 1px solid var(--line);
    border-bottom: none;
    color: var(--ink-soft);
    font-weight: 600;
}
.tab-item:hover { color: var(--brand); }
.tab-item.tab-active {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

/* --- 합계/한도 정보 카드 --- */
.stat-bar, .pay-info {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
    background: transparent;
    border: none;
    padding: 0;
}
.stat-item, .pay-info-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 18px;
    min-width: 110px;
    box-shadow: 0 2px 8px rgba(30, 40, 70, 0.04);
}
.stat-label, .pay-info-item .pay-label {
    font-size: 11px;
    color: #8a93a8;
    font-weight: 600;
}
.stat-value, .pay-info-item .num, .pay-info-item span:last-child {
    font-size: 16px;
    font-weight: 700;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}
.stat-bar { align-items: stretch; }
.stat-bar .btn-excel { align-self: center; }

/* --- 정렬 링크 --- */
.th-sort { color: var(--brand); }
.data-table th .th-sort { color: #46506a; }
.data-table th .th-sort::after { content: " ⇅"; font-size: 10px; color: #a6afc4; }

/* --- 메시지 --- */
.empty-msg { color: #99a1b3; font-size: 14px; }

/* 로그인 타이틀 아이콘 */
.login-logo { width: 22px; height: 22px; vertical-align: -3px; margin-right: 4px; }
.login-box h2 { margin-bottom: 20px; }

/* 발주 삭제 버튼 */
.btn-del {
    width: auto;
    margin: 0;
    padding: 4px 12px;
    font-size: 12px;
    background: #d0342c;
    border-radius: 5px;
}
.btn-del:hover { background: #b02a24; }

/* 화면 우하단 버전 표시 */
.app-version {
    position: fixed;
    right: 10px;
    bottom: 8px;
    font-size: 11px;
    color: #a6afc4;
    z-index: 999;
    pointer-events: none;
}

/* 재발주 버튼 */
.btn-reorder {
    display: inline-block;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    background: #2d5be3;
    border-radius: 5px;
    text-decoration: none;
    white-space: nowrap;
}
.btn-reorder:hover { background: #2249c2; }
