* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: #e5e6ea; color: #0a1230; }

.navbar { background: #050f34; color: #fff; padding: 0 20px; display: flex; align-items: center; height: 56px; box-shadow: 0 2px 8px rgba(5,15,52,0.3); }
.nav-brand { font-size: 18px; font-weight: 700; margin-right: 40px; color: #fff; }
.nav-links a { color: rgba(255,255,255,0.6); text-decoration: none; padding: 16px 14px; display: inline-block; font-size: 14px; transition: color 0.2s; }
.nav-links a:hover, .nav-links a.active { color: #fff; border-bottom: 3px solid #4a90d9; }
.nav-logout { margin-left: auto; color: #ff6b6b !important; }
.nav-dropdown { position: relative; display: inline-block; }
.nav-dropdown > span { color: rgba(255,255,255,0.6); padding: 16px 14px; display: inline-block; font-size: 14px; cursor: pointer; transition: color 0.2s; }
.nav-dropdown:hover > span, .nav-dropdown.active > span { color: #fff; border-bottom: 3px solid #4a90d9; }
.nav-dropdown-menu { display: none; position: absolute; top: 100%; left: 0; background: #0a1a44; border-radius: 0 0 8px 8px; min-width: 140px; box-shadow: 0 4px 12px rgba(0,0,0,0.3); z-index: 100; }
.nav-dropdown:hover .nav-dropdown-menu { display: block; }
.nav-dropdown-menu a { display: block; padding: 10px 16px; color: rgba(255,255,255,0.7); font-size: 13px; border-bottom: none; }
.nav-dropdown-menu a:hover { color: #fff; background: rgba(74,144,217,0.2); }
.nav-dropdown-menu a.active { color: #fff; background: rgba(74,144,217,0.15); }

.container { max-width: 1400px; margin: 20px auto; padding: 0 20px; }

.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.page-header h1 { font-size: 24px; color: #050f34; }

.card { background: #fff; border-radius: 8px; box-shadow: 0 1px 4px rgba(5,15,52,0.08), 0 0 1px rgba(5,15,52,0.05); padding: 20px; margin-bottom: 20px; border: 1px solid #d8dbe3; }
.card h2 { font-size: 16px; color: #5a6275; margin-bottom: 12px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { background: #fff; border-radius: 8px; padding: 20px; box-shadow: 0 1px 4px rgba(5,15,52,0.08); text-align: center; border: 1px solid #d8dbe3; }
.stat-card .number { font-size: 36px; font-weight: 700; color: #050f34; }
.stat-card .label { font-size: 13px; color: #5a6275; margin-top: 4px; }
.stat-card.warning .number { color: #e67e22; }
.stat-card.danger .number { color: #e74c3c; }
.stat-card.info .number { color: #1a6eff; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #d8dbe3; font-size: 14px; }
th { background: #ecedf2; font-weight: 600; color: #3d4663; font-size: 12px; text-transform: uppercase; }
tr:hover { background: #f0f1f5; }

.badge { display: inline-block; padding: 3px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.badge-idle { background: #d5f5e3; color: #1a8a4a; }
.badge-printing { background: #d6eaf8; color: #1a6eff; }
.badge-error { background: #fadbd8; color: #e74c3c; }
.badge-warning { background: #fdebd0; color: #d35400; }
.badge-unassigned { background: #fdebd0; color: #d35400; }
.badge-assigned { background: #d5f5e3; color: #1a8a4a; }

.supply-bar { width: 100px; height: 14px; background: #ecf0f1; border-radius: 7px; display: inline-block; vertical-align: middle; overflow: hidden; }
.supply-bar .fill { height: 100%; border-radius: 7px; }
.supply-bar .fill.black { background: #2c3e50; }
.supply-bar .fill.cyan { background: #00bcd4; }
.supply-bar .fill.magenta { background: #e91e63; }
.supply-bar .fill.yellow { background: #ffc107; }
.supply-bar .fill.other { background: #95a5a6; }
.supply-bar .fill.low { background: #e74c3c; }

.btn { display: inline-block; padding: 8px 16px; border: none; border-radius: 6px; font-size: 14px; cursor: pointer; text-decoration: none; transition: background 0.2s; }
.btn-primary { background: #1a56db; color: #fff; }
.btn-primary:hover { background: #1248b8; }
.btn-success { background: #1a8a4a; color: #fff; }
.btn-danger { background: #e74c3c; color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: #3d4663; margin-bottom: 4px; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 8px 12px; border: 1px solid #c5c9d4; border-radius: 6px; font-size: 14px; background: #fff; color: #0a1230;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: #1a56db; outline: none; box-shadow: 0 0 0 3px rgba(26,86,219,0.12); }
.form-group textarea { resize: vertical; min-height: 60px; }

.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #050f34 0%, #0f2057 50%, #1a3278 100%); }
.login-box { background: #fff; padding: 40px; border-radius: 12px; box-shadow: 0 8px 32px rgba(5,15,52,0.25); width: 360px; }
.login-box h1 { text-align: center; margin-bottom: 24px; font-size: 22px; color: #050f34; }
.login-box .btn { width: 100%; padding: 12px; font-size: 16px; }
.login-error { color: #e74c3c; font-size: 13px; text-align: center; margin-bottom: 12px; }

.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(5,15,52,0.5); display: none; align-items: center; justify-content: center; z-index: 100; }
.modal-overlay.active { display: flex; }
.modal { background: #fff; border-radius: 12px; padding: 24px; width: 500px; max-height: 80vh; overflow-y: auto; border: 1px solid #d8dbe3; }
.modal h2 { margin-bottom: 16px; color: #050f34; }

.filter-bar { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.filter-bar input, .filter-bar select { padding: 6px 12px; border: 1px solid #c5c9d4; border-radius: 6px; font-size: 13px; background: #fff; color: #0a1230; }
.filter-bar input:focus, .filter-bar select:focus { border-color: #1a56db; outline: none; box-shadow: 0 0 0 3px rgba(26,86,219,0.12); }

.footer { text-align: center; padding: 20px; color: #8690a2; font-size: 12px; }

/* 모니터링 테이블 */
.monitor-table th, .monitor-table td { padding: 4px 10px; font-size: 13px; vertical-align: middle; }
.monitor-table th { font-size: 11px; }

/* 스택 셀 (고객/모델/IP 한 셀에) */
.cell-stack .primary { font-weight: 600; color: #050f34; font-size: 19px; }
.cell-stack .sub { font-size: 17px; color: #5a6275; }
.cell-stack .ip { font-family: monospace; font-size: 17px; color: #5a6275; }
.cell-stack .serial-num { font-family: monospace; font-size: 9px; color: #5a6275; }

/* 수직 미니 소모품 바 */
.supply-mini { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; }
.supply-mini .bar { width: 24px; height: 36px; background: #f0f0f0; border-radius: 3px; overflow: hidden; display: flex; align-items: flex-end; border: 1px solid #e0e0e0; }
.supply-mini .bar-fill { width: 100%; border-radius: 0 0 2px 2px; }
.supply-mini .bar-fill.cyan { background: #00bcd4; }
.supply-mini .bar-fill.magenta { background: #e91e63; }
.supply-mini .bar-fill.yellow { background: #ffc107; }
.supply-mini .bar-fill.black { background: #2c3e50; }
.supply-mini .bar-fill.low { background: #e74c3c; }
.supply-mini .pct { font-size: 10px; color: #5a6275; }
.supply-mini .pct.low { color: #e74c3c; font-weight: 700; }

/* 인라인 소모품 바 (printers.php 가로 배치) */
.supply-inline { display: flex; gap: 4px; align-items: center; }

/* 소모품 그리드 테이블 (CMYK 세로 정렬) */
.supply-grid { width: auto; border-collapse: collapse; margin: 0; }
.supply-grid td { padding: 1px 0; border: none; font-size: 11px; font-family: 'Geist Mono', 'SF Mono', 'Menlo', monospace; text-align: center; min-width: 28px; }
.supply-grid .sg-hdr { font-size: 13px; font-weight: 700; padding-bottom: 2px; }
.supply-grid .sg-label { font-size: 14px; color: #5a6275; text-align: right; padding-right: 6px; font-family: -apple-system, sans-serif; white-space: nowrap; }
.supply-grid .sg-val { color: #050f34; font-weight: 600; }
.supply-grid .sg-val.low { color: #e74c3c; font-weight: 700; }
.supply-grid .sg-val.stock { color: #1a56db; font-weight: 600; }
.supply-grid tr:hover { background: transparent; }

/* 재고 인라인 폼 */
.stock-row:hover td { background: #e8eeff; }
.stock-inline-form { display: flex; gap: 6px; align-items: center; }
.stock-inline-form .sf-sel { width: 70px; padding: 6px; font-size: 15px; border: 1px solid #c5c9d4; border-radius: 4px; }
.stock-inline-form .sf-num { width: 50px; padding: 6px; font-size: 15px; text-align: center; border: 1px solid #c5c9d4; border-radius: 4px; }
.stock-inline-form .sf-memo { width: 90px; padding: 6px; font-size: 15px; border: 1px solid #c5c9d4; border-radius: 4px; }
.stock-inline-form .sf-btn { padding: 6px 14px; font-size: 15px; background: #1a56db; color: #fff; border: none; border-radius: 4px; cursor: pointer; }

/* 카운터 라벨 */
.counter-label { font-size: 15px; color: #5a6275; margin-right: 4px; }

/* 텍스트 가운데 정렬 */
.text-center { text-align: center; }

/* 숫자 우측 정렬 */
.text-right { text-align: right; }

/* 오류 건수 배지 */
.alert-count { display: inline-block; min-width: 20px; padding: 2px 6px; border-radius: 10px; font-size: 11px; font-weight: 600; text-align: center; }
.alert-count.has { background: #fadbd8; color: #e74c3c; }
.alert-count.none { color: #b0b5c3; }

/* 탭 네비게이션 */
.tab-nav { display: flex; gap: 0; border-bottom: 2px solid #d8dbe3; margin-bottom: 0; background: #fff; border-radius: 8px 8px 0 0; padding: 0 8px; }
.tab-nav a { display: inline-block; padding: 10px 18px; font-size: 13px; font-weight: 600; color: #5a6275; text-decoration: none; border-bottom: 3px solid transparent; margin-bottom: -2px; cursor: pointer; white-space: nowrap; transition: color 0.2s; }
.tab-nav a:hover { color: #050f34; background: #f0f1f5; }
.tab-nav a.active { color: #050f34; border-bottom-color: #1a56db; }
.tab-body { background: #fff; border-radius: 0 0 8px 8px; box-shadow: 0 1px 4px rgba(5,15,52,0.08); padding: 20px; margin-bottom: 20px; border: 1px solid #d8dbe3; border-top: none; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* 카운터 테이블 (컴팩트) */
.counter-table th, .counter-table td { padding: 6px 10px; font-size: 12px; }
.counter-table th { font-size: 11px; }
.counter-table .usage { color: #1a56db; font-weight: 600; }
.counter-table .usage.zero { color: #b0b5c3; font-weight: 400; }
.counter-table .replaced { background: #fff3cd; }

/* 토너 교체 감지 */
.toner-replace-badge { display: inline-block; padding: 1px 6px; border-radius: 3px; font-size: 10px; font-weight: 700; background: #d4edda; color: #155724; }

/* CMYK 요약 그리드 */
.cmyk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.cmyk-card { background: #f0f1f5; border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 8px; border: 1px solid #d8dbe3; }
.cmyk-card.low { border-color: #e74c3c; background: #fff5f5; }
.cmyk-icon { width: 32px; height: 32px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; }
.cmyk-info { display: flex; justify-content: space-between; align-items: baseline; }
.cmyk-label { font-size: 12px; color: #5a6275; }
.cmyk-pct { font-size: 18px; font-weight: 700; color: #050f34; }
.cmyk-bar { height: 6px; background: #d8dbe3; border-radius: 3px; overflow: hidden; }
.cmyk-fill { height: 100%; border-radius: 3px; transition: width 0.3s; }

/* 월 선택 필터 */
.tab-filter { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; font-size: 13px; }
.tab-filter select, .tab-filter input { padding: 4px 8px; border: 1px solid #c5c9d4; border-radius: 4px; font-size: 13px; background: #fff; color: #0a1230; }

/* 기준일 number input 화살표 크게 */
#baseDayInput::-webkit-inner-spin-button,
#baseDayInput::-webkit-outer-spin-button {
  -webkit-appearance: inner-spin-button;
  opacity: 1;
  height: 28px;
  width: 20px;
  cursor: pointer;
}

@media (max-width: 768px) {
    .navbar { flex-wrap: wrap; height: auto; padding: 10px; }
    .nav-links a { padding: 8px; font-size: 13px; }
    .stats { grid-template-columns: repeat(2, 1fr); }
    table { font-size: 12px; }
}
