*{box-sizing:border-box}
body{margin:0;background:#f4f6f8;color:#202124;font-family:Arial,"Noto Sans KR",sans-serif}
header{background:#fff;border-bottom:1px solid #ddd;padding:12px 18px;display:flex;justify-content:flex-start;align-items:center;position:sticky;top:0;z-index:5}
h1{font-size:20px;margin:0 0 2px}
#status{font-size:12px;color:#16803c}
main{max-width:1100px;margin:14px auto;padding:0 12px}
.card{background:#fff;border:1px solid #ddd;border-radius:12px;padding:15px;margin-bottom:13px;box-shadow:0 1px 3px rgba(0,0,0,.04)}
.input-card,.sheet-card,.completed-card,.recent-card{max-width:650px}
h2{font-size:17px;margin:0 0 12px}
.datebar{display:flex;align-items:center;justify-content:space-between;background:#f7f7f7;border-radius:10px;padding:5px;margin-bottom:15px;text-align:center}
.datebar button{font-size:26px;border:0;background:transparent;padding:2px 12px}.datebar b{font-size:17px}.datebar small{color:#777}
label{display:block;font-weight:700;margin:9px 0 5px}
input{width:100%;font-size:18px;padding:13px;border:1px solid #bbb;border-radius:8px}
.qty-control{display:grid;grid-template-columns:58px 1fr 58px;gap:7px;align-items:center}.qty-control input{text-align:center;font-size:20px;font-weight:700;padding:12px}.qty-step{height:52px;border:1px solid #aaa;background:#f7f7f7;border-radius:9px;font-size:28px;font-weight:700;cursor:pointer}.qty-step:active{transform:scale(.97);background:#eee}.qty-presets{display:grid;grid-template-columns:repeat(5,1fr);gap:7px;margin-top:8px}.qty-presets button{min-height:44px;border:1px solid #aaa;background:#fff;border-radius:8px;font-size:16px;font-weight:700;cursor:pointer}.qty-presets button:active{background:#eef3f8;transform:scale(.98)}
.buttons{display:flex;gap:8px;margin-top:13px}.buttons button{flex:1;padding:14px;border:0;border-radius:9px;font-size:17px;font-weight:700;cursor:pointer;min-height:50px}.register-big{font-size:18px!important;min-height:54px!important}.primary{background:#1769aa;color:#fff}.secondary{background:#eee;color:#333}
#message{height:24px;margin-top:7px;font-size:16px;font-weight:700;color:#d00000}.hidden{display:none!important}
.section-head{display:flex;justify-content:space-between;align-items:center}.section-head h2{margin-bottom:0}
.sheet-wrap{overflow:hidden;margin-top:10px}
table{border-collapse:collapse;width:100%;table-layout:fixed;min-width:0}
th,td{border:1px solid #aaa;height:34px;padding:4px 5px;overflow:hidden}
th{background:#eef3f8;text-align:center;font-size:16px}
/* 개수 칸은 기존보다 약 2/3로 줄이고, 줄어든 폭은 약품명에 배분 */
.col-item{width:50%}.col-qty{width:20%}.col-order{width:30%}
.item-cell{cursor:pointer;font-weight:600;font-size:15px;white-space:nowrap;overflow:hidden;text-overflow:clip}
.item-cell:hover{text-decoration:underline}
.qty-edit{display:flex;align-items:center;justify-content:center;gap:3px;min-width:0;white-space:nowrap}.qty-value{font-weight:700;font-size:16px}
.qty-edit-btn{border:1px solid #aaa;background:#fff;border-radius:6px;padding:5px 7px;font-size:12px;cursor:pointer;white-space:nowrap;min-height:32px}
.action-cell{padding:3px!important;text-align:center!important}
.order-actions{display:flex;flex-direction:row;gap:4px;width:100%}
.order-actions button{flex:1;width:auto;min-width:48px;min-height:36px;border-radius:6px;font-size:14px;font-weight:700;cursor:pointer;padding:6px 4px;white-space:nowrap}
.complete-action{border:1px solid #1769aa;background:#fff;color:#1769aa}.complete-action:hover{background:#eef7ff}
.cancel-btn{border:1px solid #c44;background:#fff;color:#b11}.cancel-btn:hover{background:#fff3f3}
.complete-btn{display:inline-flex;align-items:center;justify-content:center;font-weight:800;cursor:pointer;pointer-events:auto}
.complete-btn:disabled,.cancel-btn:disabled{cursor:default;opacity:.7}

.cancelled-row td{background:#f5f5f5!important;color:#888}.cancelled-text{text-decoration:line-through;text-decoration-thickness:2px;text-decoration-color:#777}
tr.urgent td{background:#fff0f0}.item-cell.urgent{color:#c00}.urgent-dot{display:inline-flex;align-items:center;justify-content:center;width:17px;height:17px;border-radius:50%;background:#d00;color:#fff;font-size:11px;margin-right:4px}
.completed-search{margin-top:10px;font-size:14px;padding:9px 10px}.completed-row{display:flex;justify-content:space-between;align-items:center;border-top:1px solid #eee;padding:9px 0;gap:8px}.completed-row>div{display:flex;align-items:center;gap:7px;flex-wrap:wrap}.completed-row small{color:#777}.completed-row button{border:1px solid #16803c;background:#f4fff7;color:#16803c;border-radius:6px;padding:6px 8px;white-space:nowrap}.done-tag{font-style:normal;color:#1769aa;font-size:12px}
.autocomplete-box{position:relative}.suggestions{position:absolute;left:0;right:0;top:calc(100% + 3px);background:#fff;border:1px solid #bbb;border-radius:8px;box-shadow:0 5px 14px rgba(0,0,0,.12);z-index:20;overflow:hidden;max-height:300px;overflow-y:auto}.suggestion{display:flex;justify-content:space-between;align-items:center;width:100%;border:0;border-bottom:1px solid #eee;background:#fff;padding:14px 12px;text-align:left;font-size:16px;cursor:pointer;min-height:48px}.suggestion:last-child{border-bottom:0}.suggestion:hover{background:#f1f7fb}.suggestion.active{background:#e5f1f8;outline:2px solid #7aa7c2;outline-offset:-2px}.suggestion em{font-style:normal;font-size:10px;color:#b11;white-space:nowrap;margin-left:7px}.suggestion.already-done{background:#fff8f8}.suggestion-empty{padding:11px;color:#888;font-size:13px}
@media(max-width:700px){
  header{padding:10px 12px}h1{font-size:18px}main{margin-top:8px}.card{padding:12px}.input-card,.sheet-card,.completed-card,.recent-card{max-width:none}.input-card{position:static;z-index:auto}
  th,td{padding:4px 2px;font-size:12px}.col-item{width:50%}.col-qty{width:20%}.col-order{width:30%}
  .item-cell{font-size:14px}.qty-edit{gap:3px}.qty-edit-btn{padding:5px 6px;font-size:12px;min-height:32px}.order-actions{gap:3px}.order-actions button{font-size:14px;min-height:36px;min-width:48px;padding:6px 4px;white-space:nowrap}
  .qty-control{grid-template-columns:56px 1fr 56px}.qty-step{height:52px}.qty-presets{gap:5px}.qty-presets button{min-height:46px;font-size:15px}.register-big{min-height:56px!important;font-size:18px!important}.suggestion{font-size:16px;padding:14px 11px}
  .completed-row,}


.register-title-row{display:flex;align-items:center;justify-content:space-between;gap:10px}
.catalog-tools{display:flex;align-items:center}
.catalog-upload{border:1px solid #bbb;background:#fff;border-radius:8px;padding:7px 10px;font-size:13px;cursor:pointer;white-space:nowrap}
.catalog-msg{min-height:20px;margin:4px 0 8px;font-size:13px}
.catalog-msg.ok{color:#137333;font-weight:600}
.catalog-msg.error{color:#c5221f;font-weight:600}
@media (max-width:600px){.catalog-upload{padding:8px 9px;font-size:12px}.register-title-row{gap:6px}}

/* 태블릿 가로 화면: 주문 등록과 주문 목록을 좌우 50:50으로 배치 */
@media (hover: none) and (pointer: coarse) and (orientation: landscape) and (min-width: 701px) {
  main{max-width:1400px;margin:10px auto;padding:0 10px}
  #daily{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:12px;align-items:start}
  .input-card,.sheet-card{max-width:none;width:100%;margin-bottom:0}
  .completed-card{grid-column:1 / -1;max-width:none;width:100%}
  .sheet-card{height:calc(100vh - 82px);min-height:420px;display:flex;flex-direction:column}
  .sheet-wrap{flex:1;min-height:0;overflow:auto}
  .input-card{min-height:420px}
}

.catalog-tools{gap:6px;flex-wrap:wrap;justify-content:flex-end}.catalog-manage{border:1px solid #aaa;background:#f7f7f7;border-radius:8px;padding:7px 10px;font-size:13px;cursor:pointer;white-space:nowrap}.catalog-manager{background:#fff;border:1px solid #ddd;border-radius:12px;padding:15px;margin:0 auto 13px;max-width:1400px;box-shadow:0 1px 3px rgba(0,0,0,.04)}.catalog-manager-head{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-bottom:12px}.catalog-manager-head h2{margin:0 0 2px}.catalog-manager-head small{color:#777}.catalog-close{border:1px solid #aaa;background:#fff;border-radius:8px;padding:7px 12px;cursor:pointer}.catalog-add{display:grid;grid-template-columns:1fr 120px;gap:8px;margin-bottom:8px}.catalog-add input{font-size:16px;padding:10px}.catalog-add button{border:0;border-radius:8px;font-weight:700;cursor:pointer}.catalog-manager-search{font-size:15px;padding:10px;margin-bottom:8px}.catalog-manager-list{border:1px solid #ddd;border-radius:8px;max-height:55vh;overflow:auto}.catalog-row{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:8px 10px;border-bottom:1px solid #eee;min-height:48px}.catalog-row:last-child{border-bottom:0}.catalog-row-name{font-size:15px;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.catalog-row-actions{display:flex;gap:5px;flex:none}.catalog-row-actions button{border:1px solid #aaa;background:#fff;border-radius:6px;padding:6px 9px;cursor:pointer}.catalog-row-actions .danger{color:#b11;border-color:#c99}.catalog-manager.hidden{display:none!important}@media(max-width:600px){.catalog-tools{gap:4px}.catalog-manage{padding:8px 9px;font-size:12px}.catalog-add{grid-template-columns:1fr 100px}.catalog-row-name{font-size:14px}}

/* 태블릿 가로: 오른쪽 주문목록을 더 크게 표시 */
@media (hover: none) and (pointer: coarse) and (orientation: landscape) and (min-width: 701px) {
  .sheet-card th,
  .sheet-card td{padding:9px 6px;font-size:16px}
  .sheet-card th{font-size:18px}
  .sheet-card .item-cell{font-size:17px;line-height:1.35}
  .sheet-card .qty-value{font-size:17px}
  .sheet-card .qty-edit{gap:5px}
  .sheet-card .qty-edit-btn{font-size:14px;min-height:40px;padding:7px 9px}
  .sheet-card .order-actions{gap:6px}
  .sheet-card .order-actions button{font-size:16px;min-height:44px;min-width:58px;padding:8px 7px}
  .sheet-card .urgent-dot{width:19px;height:19px;font-size:12px;margin-right:5px}
}
